xilinx_zynqmp.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Configuration for Xilinx ZynqMP
  4. * (C) Copyright 2014 - 2015 Xilinx, Inc.
  5. * Michal Simek <michal.simek@xilinx.com>
  6. *
  7. * Based on Configuration for Versatile Express
  8. */
  9. #ifndef __XILINX_ZYNQMP_H
  10. #define __XILINX_ZYNQMP_H
  11. #define CONFIG_REMAKE_ELF
  12. /* #define CONFIG_ARMV8_SWITCH_TO_EL1 */
  13. /* Generic Interrupt Controller Definitions */
  14. #define CONFIG_GICV2
  15. #define GICD_BASE 0xF9010000
  16. #define GICC_BASE 0xF9020000
  17. #define CONFIG_SYS_INIT_SP_ADDR CONFIG_SYS_TEXT_BASE
  18. /* Generic Timer Definitions - setup in EL3. Setup by ATF for other cases */
  19. #if !defined(COUNTER_FREQUENCY)
  20. # define COUNTER_FREQUENCY 100000000
  21. #endif
  22. /* Size of malloc() pool */
  23. #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 0x4000000)
  24. /* Serial setup */
  25. #define CONFIG_CPU_ARMV8
  26. #define CONFIG_SYS_BAUDRATE_TABLE \
  27. { 4800, 9600, 19200, 38400, 57600, 115200 }
  28. /* BOOTP options */
  29. #define CONFIG_BOOTP_BOOTFILESIZE
  30. #define CONFIG_BOOTP_MAY_FAIL
  31. #ifdef CONFIG_NAND_ARASAN
  32. # define CONFIG_SYS_MAX_NAND_DEVICE 1
  33. # define CONFIG_SYS_NAND_ONFI_DETECTION
  34. #endif
  35. #if defined(CONFIG_SPL_BUILD)
  36. #define CONFIG_ZYNQMP_PSU_INIT_ENABLED
  37. #endif
  38. /* Miscellaneous configurable options */
  39. #define CONFIG_SYS_LOAD_ADDR 0x8000000
  40. #if defined(CONFIG_ZYNQMP_USB)
  41. #define DFU_DEFAULT_POLL_TIMEOUT 300
  42. #define CONFIG_THOR_RESET_OFF
  43. #ifndef CONFIG_SPL_BUILD
  44. # define PARTS_DEFAULT \
  45. "partitions=uuid_disk=${uuid_gpt_disk};" \
  46. "name=""boot"",size=16M,uuid=${uuid_gpt_boot};" \
  47. "name=""Linux"",size=-M,uuid=${uuid_gpt_Linux}\0"
  48. #endif
  49. #endif
  50. #if !defined(PARTS_DEFAULT)
  51. # define PARTS_DEFAULT
  52. #endif
  53. /* Monitor Command Prompt */
  54. /* Console I/O Buffer Size */
  55. #define CONFIG_SYS_CBSIZE 2048
  56. #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
  57. #define CONFIG_SYS_MAXARGS 64
  58. /* Ethernet driver */
  59. #if defined(CONFIG_ZYNQ_GEM)
  60. # define CONFIG_SYS_FAULT_ECHO_LINK_DOWN
  61. # define PHY_ANEG_TIMEOUT 20000
  62. #endif
  63. #define CONFIG_SYS_BOOTM_LEN (60 * 1024 * 1024)
  64. #define CONFIG_CLOCKS
  65. #define ENV_MEM_LAYOUT_SETTINGS \
  66. "fdt_addr_r=0x40000000\0" \
  67. "fdt_size_r=0x400000\0" \
  68. "pxefile_addr_r=0x10000000\0" \
  69. "kernel_addr_r=0x18000000\0" \
  70. "kernel_size_r=0x10000000\0" \
  71. "kernel_comp_addr_r=0x30000000\0" \
  72. "kernel_comp_size=0x3C00000\0" \
  73. "scriptaddr=0x20000000\0" \
  74. "ramdisk_addr_r=0x02100000\0" \
  75. "script_size_f=0x80000\0" \
  76. #if defined(CONFIG_MMC_SDHCI_ZYNQ)
  77. # define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) func(MMC, mmc, 1)
  78. #else
  79. # define BOOT_TARGET_DEVICES_MMC(func)
  80. #endif
  81. #if defined(CONFIG_SATA_CEVA)
  82. # define BOOT_TARGET_DEVICES_SCSI(func) func(SCSI, scsi, 0)
  83. #else
  84. # define BOOT_TARGET_DEVICES_SCSI(func)
  85. #endif
  86. #if defined(CONFIG_ZYNQMP_USB)
  87. # define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0) func(USB, usb, 1)
  88. #else
  89. # define BOOT_TARGET_DEVICES_USB(func)
  90. #endif
  91. #if defined(CONFIG_CMD_PXE) && defined(CONFIG_CMD_DHCP)
  92. # define BOOT_TARGET_DEVICES_PXE(func) func(PXE, pxe, na)
  93. #else
  94. # define BOOT_TARGET_DEVICES_PXE(func)
  95. #endif
  96. #if defined(CONFIG_CMD_DHCP)
  97. # define BOOT_TARGET_DEVICES_DHCP(func) func(DHCP, dhcp, na)
  98. #else
  99. # define BOOT_TARGET_DEVICES_DHCP(func)
  100. #endif
  101. #if defined(CONFIG_ZYNQMP_GQSPI)
  102. # define BOOT_TARGET_DEVICES_QSPI(func) func(QSPI, qspi, 0)
  103. #else
  104. # define BOOT_TARGET_DEVICES_QSPI(func)
  105. #endif
  106. #if defined(CONFIG_NAND_ARASAN)
  107. # define BOOT_TARGET_DEVICES_NAND(func) func(NAND, nand, 0)
  108. #else
  109. # define BOOT_TARGET_DEVICES_NAND(func)
  110. #endif
  111. #define BOOTENV_DEV_QSPI(devtypeu, devtypel, instance) \
  112. "bootcmd_" #devtypel #instance "=sf probe " #instance " 0 0 && " \
  113. "sf read $scriptaddr $script_offset_f $script_size_f && " \
  114. "echo QSPI: Trying to boot script at ${scriptaddr} && " \
  115. "source ${scriptaddr}; echo QSPI: SCRIPT FAILED: continuing...;\0"
  116. #define BOOTENV_DEV_NAME_QSPI(devtypeu, devtypel, instance) \
  117. #devtypel #instance " "
  118. #define BOOTENV_DEV_NAND(devtypeu, devtypel, instance) \
  119. "bootcmd_" #devtypel #instance "= nand info && " \
  120. "nand read $scriptaddr $script_offset_f $script_size_f && " \
  121. "echo NAND: Trying to boot script at ${scriptaddr} && " \
  122. "source ${scriptaddr}; echo NAND: SCRIPT FAILED: continuing...;\0"
  123. #define BOOTENV_DEV_NAME_NAND(devtypeu, devtypel, instance) \
  124. #devtypel #instance " "
  125. #define BOOT_TARGET_DEVICES_JTAG(func) func(JTAG, jtag, na)
  126. #define BOOTENV_DEV_JTAG(devtypeu, devtypel, instance) \
  127. "bootcmd_jtag=echo JTAG: Trying to boot script at ${scriptaddr} && " \
  128. "source ${scriptaddr}; echo JTAG: SCRIPT FAILED: continuing...;\0"
  129. #define BOOTENV_DEV_NAME_JTAG(devtypeu, devtypel, instance) \
  130. "jtag "
  131. #define BOOT_TARGET_DEVICES_USB_DFU(func) \
  132. func(USB_DFU, usb_dfu, 0) func(USB_DFU, usb_dfu, 1)
  133. #define BOOTENV_DEV_USB_DFU(devtypeu, devtypel, instance) \
  134. "bootcmd_" #devtypel #instance "=setenv dfu_alt_info boot.scr ram " \
  135. "$scriptaddr $script_size_f && " \
  136. "dfu " #instance " ram " #instance " 60 && " \
  137. "echo DFU" #instance ": Trying to boot script at ${scriptaddr} && " \
  138. "source ${scriptaddr}; " \
  139. "echo DFU" #instance ": SCRIPT FAILED: continuing...;\0"
  140. #define BOOTENV_DEV_NAME_USB_DFU(devtypeu, devtypel, instance) \
  141. ""
  142. #define BOOT_TARGET_DEVICES_USB_THOR(func) \
  143. func(USB_THOR, usb_thor, 0) func(USB_THOR, usb_thor, 1)
  144. #define BOOTENV_DEV_USB_THOR(devtypeu, devtypel, instance) \
  145. "bootcmd_" #devtypel #instance "=setenv dfu_alt_info boot.scr ram " \
  146. "$scriptaddr $script_size_f && " \
  147. "thordown " #instance " ram " #instance " && " \
  148. "echo THOR" #instance ": Trying to boot script at ${scriptaddr} && " \
  149. "source ${scriptaddr}; " \
  150. "echo THOR" #instance ": SCRIPT FAILED: continuing...;\0"
  151. #define BOOTENV_DEV_NAME_USB_THOR(devtypeu, devtypel, instance) \
  152. ""
  153. #define BOOT_TARGET_DEVICES(func) \
  154. BOOT_TARGET_DEVICES_JTAG(func) \
  155. BOOT_TARGET_DEVICES_MMC(func) \
  156. BOOT_TARGET_DEVICES_QSPI(func) \
  157. BOOT_TARGET_DEVICES_NAND(func) \
  158. BOOT_TARGET_DEVICES_USB_DFU(func) \
  159. BOOT_TARGET_DEVICES_USB_THOR(func) \
  160. BOOT_TARGET_DEVICES_USB(func) \
  161. BOOT_TARGET_DEVICES_SCSI(func) \
  162. BOOT_TARGET_DEVICES_PXE(func) \
  163. BOOT_TARGET_DEVICES_DHCP(func)
  164. #include <config_distro_bootcmd.h>
  165. /* Initial environment variables */
  166. #ifndef CONFIG_EXTRA_ENV_SETTINGS
  167. #define CONFIG_EXTRA_ENV_SETTINGS \
  168. ENV_MEM_LAYOUT_SETTINGS \
  169. BOOTENV
  170. #endif
  171. /* SPL can't handle all huge variables - define just DFU */
  172. #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_DFU)
  173. #undef CONFIG_EXTRA_ENV_SETTINGS
  174. # define CONFIG_EXTRA_ENV_SETTINGS \
  175. "dfu_alt_info_ram=uboot.bin ram 0x8000000 0x1000000;" \
  176. "atf-uboot.ub ram 0x10000000 0x1000000;" \
  177. "Image ram 0x80000 0x3f80000;" \
  178. "system.dtb ram 0x4000000 0x100000\0" \
  179. "dfu_bufsiz=0x1000\0"
  180. #endif
  181. #define CONFIG_SPL_STACK 0xfffffffc
  182. #define CONFIG_SPL_MAX_SIZE 0x40000
  183. /* Just random location in OCM */
  184. #define CONFIG_SPL_BSS_START_ADDR 0x0
  185. #define CONFIG_SPL_BSS_MAX_SIZE 0x80000
  186. #if defined(CONFIG_SPL_SPI_FLASH_SUPPORT)
  187. # define CONFIG_SYS_SPI_KERNEL_OFFS 0x80000
  188. # define CONFIG_SYS_SPI_ARGS_OFFS 0xa0000
  189. # define CONFIG_SYS_SPI_ARGS_SIZE 0xa0000
  190. #endif
  191. /* u-boot is like dtb */
  192. #define CONFIG_SPL_FS_LOAD_ARGS_NAME "u-boot.bin"
  193. #define CONFIG_SYS_SPL_ARGS_ADDR 0x8000000
  194. /* ATF is my kernel image */
  195. #define CONFIG_SPL_FS_LOAD_KERNEL_NAME "atf-uboot.ub"
  196. /* MMC support */
  197. #ifdef CONFIG_MMC_SDHCI_ZYNQ
  198. # define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0 /* unused */
  199. # define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS 0 /* unused */
  200. # define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0 /* unused */
  201. # if defined(CONFIG_SPL_LOAD_FIT)
  202. # define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot.itb"
  203. # else
  204. # define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot.img"
  205. # endif
  206. #endif
  207. #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_DFU)
  208. # define CONFIG_SPL_ENV_SUPPORT
  209. # define CONFIG_SPL_HASH
  210. # define CONFIG_ENV_MAX_ENTRIES 10
  211. #endif
  212. #define CONFIG_SYS_SPL_MALLOC_START 0x20000000
  213. #define CONFIG_SYS_SPL_MALLOC_SIZE 0x1000000
  214. #ifdef CONFIG_SPL_SYS_MALLOC_SIMPLE
  215. # error "Disable CONFIG_SPL_SYS_MALLOC_SIMPLE. Full malloc needs to be used"
  216. #endif
  217. #endif /* __XILINX_ZYNQMP_H */