ls1043a_common.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (C) 2015 Freescale Semiconductor
  4. * Copyright 2019-2020 NXP
  5. */
  6. #ifndef __LS1043A_COMMON_H
  7. #define __LS1043A_COMMON_H
  8. /* SPL build */
  9. #ifdef CONFIG_SPL_BUILD
  10. #define SPL_NO_FMAN
  11. #define SPL_NO_DSPI
  12. #define SPL_NO_PCIE
  13. #define SPL_NO_ENV
  14. #define SPL_NO_MISC
  15. #define SPL_NO_USB
  16. #define SPL_NO_SATA
  17. #define SPL_NO_QE
  18. #define SPL_NO_EEPROM
  19. #endif
  20. #if (defined(CONFIG_SPL_BUILD) && defined(CONFIG_NAND_BOOT))
  21. #define SPL_NO_MMC
  22. #endif
  23. #if (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SD_BOOT_QSPI))
  24. #define SPL_NO_IFC
  25. #endif
  26. #define CONFIG_REMAKE_ELF
  27. #define CONFIG_GICV2
  28. #include <asm/arch/stream_id_lsch2.h>
  29. #include <asm/arch/config.h>
  30. /* Link Definitions */
  31. #ifdef CONFIG_TFABOOT
  32. #define CONFIG_SYS_INIT_SP_ADDR CONFIG_SYS_TEXT_BASE
  33. #else
  34. #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_FSL_OCRAM_BASE + 0xfff0)
  35. #endif
  36. #define CONFIG_SKIP_LOWLEVEL_INIT
  37. #define CONFIG_VERY_BIG_RAM
  38. #define CONFIG_SYS_DDR_SDRAM_BASE 0x80000000
  39. #define CONFIG_SYS_FSL_DDR_SDRAM_BASE_PHY 0
  40. #define CONFIG_SYS_SDRAM_BASE CONFIG_SYS_DDR_SDRAM_BASE
  41. #define CONFIG_SYS_DDR_BLOCK2_BASE 0x880000000ULL
  42. #define CPU_RELEASE_ADDR secondary_boot_addr
  43. /* Generic Timer Definitions */
  44. #define COUNTER_FREQUENCY 25000000 /* 25MHz */
  45. /* Size of malloc() pool */
  46. #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 1024 * 1024)
  47. /* Serial Port */
  48. #define CONFIG_SYS_NS16550_SERIAL
  49. #define CONFIG_SYS_NS16550_REG_SIZE 1
  50. #define CONFIG_SYS_NS16550_CLK (get_serial_clock())
  51. #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
  52. /* SD boot SPL */
  53. #ifdef CONFIG_SD_BOOT
  54. #define CONFIG_SPL_MAX_SIZE 0x17000
  55. #define CONFIG_SPL_STACK 0x1001e000
  56. #define CONFIG_SPL_PAD_TO 0x1d000
  57. #define CONFIG_SYS_SPL_MALLOC_START (CONFIG_SPL_BSS_START_ADDR + \
  58. CONFIG_SPL_BSS_MAX_SIZE)
  59. #define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000
  60. #define CONFIG_SPL_BSS_START_ADDR 0x8f000000
  61. #define CONFIG_SPL_BSS_MAX_SIZE 0x80000
  62. #ifdef CONFIG_NXP_ESBC
  63. #define CONFIG_U_BOOT_HDR_SIZE (16 << 10)
  64. /*
  65. * HDR would be appended at end of image and copied to DDR along
  66. * with U-Boot image. Here u-boot max. size is 512K. So if binary
  67. * size increases then increase this size in case of secure boot as
  68. * it uses raw u-boot image instead of fit image.
  69. */
  70. #define CONFIG_SYS_MONITOR_LEN (0x100000 + CONFIG_U_BOOT_HDR_SIZE)
  71. #else
  72. #define CONFIG_SYS_MONITOR_LEN 0x100000
  73. #endif /* ifdef CONFIG_NXP_ESBC */
  74. #endif
  75. /* NAND SPL */
  76. #ifdef CONFIG_NAND_BOOT
  77. #define CONFIG_SPL_PBL_PAD
  78. #define CONFIG_SPL_MAX_SIZE 0x1a000
  79. #define CONFIG_SPL_STACK 0x1001d000
  80. #define CONFIG_SYS_NAND_U_BOOT_DST CONFIG_SYS_TEXT_BASE
  81. #define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE
  82. #define CONFIG_SYS_SPL_MALLOC_START 0x80200000
  83. #define CONFIG_SPL_BSS_START_ADDR 0x80100000
  84. #define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000
  85. #define CONFIG_SPL_BSS_MAX_SIZE 0x80000
  86. #ifdef CONFIG_NXP_ESBC
  87. #define CONFIG_U_BOOT_HDR_SIZE (16 << 10)
  88. #endif /* ifdef CONFIG_NXP_ESBC */
  89. #ifdef CONFIG_U_BOOT_HDR_SIZE
  90. /*
  91. * HDR would be appended at end of image and copied to DDR along
  92. * with U-Boot image. Here u-boot max. size is 512K. So if binary
  93. * size increases then increase this size in case of secure boot as
  94. * it uses raw u-boot image instead of fit image.
  95. */
  96. #define CONFIG_SYS_MONITOR_LEN (0x100000 + CONFIG_U_BOOT_HDR_SIZE)
  97. #else
  98. #define CONFIG_SYS_MONITOR_LEN 0x100000
  99. #endif /* ifdef CONFIG_U_BOOT_HDR_SIZE */
  100. #endif
  101. /* GPIO */
  102. #ifdef CONFIG_DM_GPIO
  103. #ifndef CONFIG_MPC8XXX_GPIO
  104. #define CONFIG_MPC8XXX_GPIO
  105. #endif
  106. #endif
  107. /* IFC */
  108. #ifndef SPL_NO_IFC
  109. #if defined(CONFIG_TFABOOT) || \
  110. (!defined(CONFIG_QSPI_BOOT) && !defined(CONFIG_SD_BOOT_QSPI))
  111. #define CONFIG_FSL_IFC
  112. /*
  113. * CONFIG_SYS_FLASH_BASE has the final address (core view)
  114. * CONFIG_SYS_FLASH_BASE_PHYS has the final address (IFC view)
  115. * CONFIG_SYS_FLASH_BASE_PHYS_EARLY has the temporary IFC address
  116. * CONFIG_SYS_TEXT_BASE is linked to 0x60000000 for booting
  117. */
  118. #define CONFIG_SYS_FLASH_BASE 0x60000000
  119. #define CONFIG_SYS_FLASH_BASE_PHYS CONFIG_SYS_FLASH_BASE
  120. #define CONFIG_SYS_FLASH_BASE_PHYS_EARLY 0x00000000
  121. #ifdef CONFIG_MTD_NOR_FLASH
  122. #define CONFIG_SYS_FLASH_QUIET_TEST
  123. #define CONFIG_FLASH_SHOW_PROGRESS 45 /* count down from 45/5: 9..1 */
  124. #endif
  125. #endif
  126. #endif
  127. /* I2C */
  128. #if !CONFIG_IS_ENABLED(DM_I2C)
  129. #define CONFIG_SYS_I2C
  130. #define CONFIG_SYS_I2C_MXC_I2C1 /* enable I2C bus 1 */
  131. #define CONFIG_SYS_I2C_MXC_I2C2 /* enable I2C bus 2 */
  132. #define CONFIG_SYS_I2C_MXC_I2C3 /* enable I2C bus 3 */
  133. #define CONFIG_SYS_I2C_MXC_I2C4 /* enable I2C bus 4 */
  134. #else
  135. #define CONFIG_I2C_SET_DEFAULT_BUS_NUM
  136. #define CONFIG_I2C_DEFAULT_BUS_NUMBER 0
  137. #endif
  138. /* PCIe */
  139. #ifndef SPL_NO_PCIE
  140. #define CONFIG_PCIE1 /* PCIE controller 1 */
  141. #define CONFIG_PCIE2 /* PCIE controller 2 */
  142. #define CONFIG_PCIE3 /* PCIE controller 3 */
  143. #ifdef CONFIG_PCI
  144. #define CONFIG_PCI_SCAN_SHOW
  145. #endif
  146. #endif
  147. /* MMC */
  148. #ifndef SPL_NO_MMC
  149. #ifdef CONFIG_MMC
  150. #define CONFIG_SYS_FSL_MMC_HAS_CAPBLT_VS33
  151. #endif
  152. #endif
  153. /* DSPI */
  154. #ifndef SPL_NO_DSPI
  155. #ifdef CONFIG_FSL_DSPI
  156. #define CONFIG_SPI_FLASH_STMICRO /* cs0 */
  157. #define CONFIG_SPI_FLASH_SST /* cs1 */
  158. #define CONFIG_SPI_FLASH_EON /* cs2 */
  159. #endif
  160. #endif
  161. /* FMan ucode */
  162. #ifndef SPL_NO_FMAN
  163. #define CONFIG_SYS_DPAA_FMAN
  164. #ifdef CONFIG_SYS_DPAA_FMAN
  165. #define CONFIG_SYS_FM_MURAM_SIZE 0x60000
  166. #ifdef CONFIG_TFABOOT
  167. #define CONFIG_SYS_FMAN_FW_ADDR 0x900000
  168. #define CONFIG_SYS_QE_FW_ADDR 0x940000
  169. #else
  170. #ifdef CONFIG_NAND_BOOT
  171. /* Store Fman ucode at offeset 0x900000(72 blocks). */
  172. #define CONFIG_SYS_FMAN_FW_ADDR (72 * CONFIG_SYS_NAND_BLOCK_SIZE)
  173. #elif defined(CONFIG_SD_BOOT)
  174. /*
  175. * PBL SD boot image should stored at 0x1000(8 blocks), the size of the image is
  176. * about 1MB (2040 blocks), Env is stored after the image, and the env size is
  177. * 0x2000 (16 blocks), 8 + 2040 + 16 = 2064, enlarge it to 18432(0x4800).
  178. */
  179. #define CONFIG_SYS_FMAN_FW_ADDR (512 * 0x4800)
  180. #define CONFIG_SYS_QE_FW_ADDR (512 * 0x4A00)
  181. #elif defined(CONFIG_QSPI_BOOT)
  182. #define CONFIG_SYS_FMAN_FW_ADDR 0x40900000
  183. #else
  184. /* FMan fireware Pre-load address */
  185. #define CONFIG_SYS_FMAN_FW_ADDR 0x60900000
  186. #define CONFIG_SYS_QE_FW_ADDR 0x60940000
  187. #endif
  188. #endif
  189. #define CONFIG_SYS_QE_FMAN_FW_LENGTH 0x10000
  190. #define CONFIG_SYS_FDT_PAD (0x3000 + CONFIG_SYS_QE_FMAN_FW_LENGTH)
  191. #endif
  192. #endif
  193. /* Miscellaneous configurable options */
  194. #define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_DDR_SDRAM_BASE + 0x10000000)
  195. #define CONFIG_HWCONFIG
  196. #define HWCONFIG_BUFFER_SIZE 128
  197. #ifndef SPL_NO_MISC
  198. #ifndef CONFIG_SPL_BUILD
  199. #define BOOT_TARGET_DEVICES(func) \
  200. func(MMC, mmc, 0) \
  201. func(USB, usb, 0) \
  202. func(DHCP, dhcp, na)
  203. #include <config_distro_bootcmd.h>
  204. #endif
  205. /* Initial environment variables */
  206. #define CONFIG_EXTRA_ENV_SETTINGS \
  207. "hwconfig=fsl_ddr:bank_intlv=auto\0" \
  208. "fdt_high=0xffffffffffffffff\0" \
  209. "initrd_high=0xffffffffffffffff\0" \
  210. "fdt_addr=0x64f00000\0" \
  211. "kernel_addr=0x61000000\0" \
  212. "scriptaddr=0x80000000\0" \
  213. "scripthdraddr=0x80080000\0" \
  214. "fdtheader_addr_r=0x80100000\0" \
  215. "kernelheader_addr_r=0x80200000\0" \
  216. "kernel_addr_r=0x81000000\0" \
  217. "kernel_start=0x1000000\0" \
  218. "kernelheader_start=0x800000\0" \
  219. "fdt_addr_r=0x90000000\0" \
  220. "load_addr=0xa0000000\0" \
  221. "kernelheader_addr=0x60600000\0" \
  222. "kernel_size=0x2800000\0" \
  223. "kernelheader_size=0x40000\0" \
  224. "kernel_addr_sd=0x8000\0" \
  225. "kernel_size_sd=0x14000\0" \
  226. "kernelhdr_addr_sd=0x3000\0" \
  227. "kernelhdr_size_sd=0x10\0" \
  228. "console=ttyS0,115200\0" \
  229. "boot_os=y\0" \
  230. "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
  231. BOOTENV \
  232. "boot_scripts=ls1043ardb_boot.scr\0" \
  233. "boot_script_hdr=hdr_ls1043ardb_bs.out\0" \
  234. "scan_dev_for_boot_part=" \
  235. "part list ${devtype} ${devnum} devplist; " \
  236. "env exists devplist || setenv devplist 1; " \
  237. "for distro_bootpart in ${devplist}; do " \
  238. "if fstype ${devtype} " \
  239. "${devnum}:${distro_bootpart} " \
  240. "bootfstype; then " \
  241. "run scan_dev_for_boot; " \
  242. "fi; " \
  243. "done\0" \
  244. "boot_a_script=" \
  245. "load ${devtype} ${devnum}:${distro_bootpart} " \
  246. "${scriptaddr} ${prefix}${script}; " \
  247. "env exists secureboot && load ${devtype} " \
  248. "${devnum}:${distro_bootpart} " \
  249. "${scripthdraddr} ${prefix}${boot_script_hdr}; " \
  250. "env exists secureboot " \
  251. "&& esbc_validate ${scripthdraddr};" \
  252. "source ${scriptaddr}\0" \
  253. "qspi_bootcmd=echo Trying load from qspi..;" \
  254. "sf probe && sf read $load_addr " \
  255. "$kernel_start $kernel_size; env exists secureboot " \
  256. "&& sf read $kernelheader_addr_r $kernelheader_start " \
  257. "$kernelheader_size && esbc_validate ${kernelheader_addr_r}; " \
  258. "bootm $load_addr#$board\0" \
  259. "nor_bootcmd=echo Trying load from nor..;" \
  260. "cp.b $kernel_addr $load_addr " \
  261. "$kernel_size; env exists secureboot " \
  262. "&& cp.b $kernelheader_addr $kernelheader_addr_r " \
  263. "$kernelheader_size && esbc_validate ${kernelheader_addr_r}; " \
  264. "bootm $load_addr#$board\0" \
  265. "nand_bootcmd=echo Trying load from NAND..;" \
  266. "nand info; nand read $load_addr " \
  267. "$kernel_start $kernel_size; env exists secureboot " \
  268. "&& nand read $kernelheader_addr_r $kernelheader_start " \
  269. "$kernelheader_size && esbc_validate ${kernelheader_addr_r}; " \
  270. "bootm $load_addr#$board\0" \
  271. "sd_bootcmd=echo Trying load from SD ..;" \
  272. "mmcinfo; mmc read $load_addr " \
  273. "$kernel_addr_sd $kernel_size_sd && " \
  274. "env exists secureboot && mmc read $kernelheader_addr_r " \
  275. "$kernelhdr_addr_sd $kernelhdr_size_sd " \
  276. " && esbc_validate ${kernelheader_addr_r};" \
  277. "bootm $load_addr#$board\0"
  278. #undef CONFIG_BOOTCOMMAND
  279. #ifdef CONFIG_TFABOOT
  280. #define QSPI_NOR_BOOTCOMMAND "run distro_bootcmd; run qspi_bootcmd; " \
  281. "env exists secureboot && esbc_halt;"
  282. #define SD_BOOTCOMMAND "run distro_bootcmd; run sd_bootcmd; " \
  283. "env exists secureboot && esbc_halt;"
  284. #define IFC_NOR_BOOTCOMMAND "run distro_bootcmd; run nor_bootcmd; " \
  285. "env exists secureboot && esbc_halt;"
  286. #define IFC_NAND_BOOTCOMMAND "run distro_bootcmd; run nand_bootcmd; " \
  287. "env exists secureboot && esbc_halt;"
  288. #else
  289. #if defined(CONFIG_QSPI_BOOT) || defined(CONFIG_SD_BOOT_QSPI)
  290. #define CONFIG_BOOTCOMMAND "run distro_bootcmd; run qspi_bootcmd; " \
  291. "env exists secureboot && esbc_halt;"
  292. #elif defined(CONFIG_SD_BOOT)
  293. #define CONFIG_BOOTCOMMAND "run distro_bootcmd; run sd_bootcmd; " \
  294. "env exists secureboot && esbc_halt;"
  295. #else
  296. #define CONFIG_BOOTCOMMAND "run distro_bootcmd; run nor_bootcmd; " \
  297. "env exists secureboot && esbc_halt;"
  298. #endif
  299. #endif
  300. #endif
  301. /* Monitor Command Prompt */
  302. #define CONFIG_SYS_CBSIZE 512 /* Console I/O Buffer Size */
  303. #define CONFIG_SYS_MAXARGS 64 /* max command args */
  304. #define CONFIG_SYS_BOOTM_LEN (64 << 20) /* Increase max gunzip size */
  305. #include <asm/arch/soc.h>
  306. #endif /* __LS1043A_COMMON_H */