ti_omap5_common.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2013
  4. * Texas Instruments Incorporated.
  5. * Sricharan R <r.sricharan@ti.com>
  6. *
  7. * Derived from OMAP4 done by:
  8. * Aneesh V <aneesh@ti.com>
  9. *
  10. * TI OMAP5 AND DRA7XX common configuration settings
  11. *
  12. * For more details, please see the technical documents listed at
  13. * http://www.ti.com/product/omap5432
  14. */
  15. #ifndef __CONFIG_TI_OMAP5_COMMON_H
  16. #define __CONFIG_TI_OMAP5_COMMON_H
  17. /* Use General purpose timer 1 */
  18. #define CONFIG_SYS_TIMERBASE GPT2_BASE
  19. /*
  20. * For the DDR timing information we can either dynamically determine
  21. * the timings to use or use pre-determined timings (based on using the
  22. * dynamic method. Default to the static timing infomation.
  23. */
  24. #define CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS
  25. #ifndef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS
  26. #define CONFIG_SYS_AUTOMATIC_SDRAM_DETECTION
  27. #define CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS
  28. #endif
  29. #define CONFIG_PALMAS_POWER
  30. #include <linux/stringify.h>
  31. #include <asm/arch/cpu.h>
  32. #include <asm/arch/omap.h>
  33. #include <configs/ti_armv7_omap.h>
  34. /*
  35. * Hardware drivers
  36. */
  37. #define CONFIG_SYS_NS16550_CLK 48000000
  38. #if !defined(CONFIG_DM_SERIAL)
  39. #define CONFIG_SYS_NS16550_SERIAL
  40. #define CONFIG_SYS_NS16550_REG_SIZE (-4)
  41. #endif
  42. /*
  43. * Environment setup
  44. */
  45. #ifndef DFUARGS
  46. #define DFUARGS
  47. #endif
  48. #include <environment/ti/mmc.h>
  49. #include <environment/ti/nand.h>
  50. #ifndef CONSOLEDEV
  51. #define CONSOLEDEV "ttyS2"
  52. #endif
  53. #ifndef PARTS_DEFAULT
  54. /*
  55. * Default GPT tables for eMMC (Linux and Android). Notes:
  56. * 1. Keep partitions aligned to erase group size (512 KiB) when possible
  57. * 2. Keep partitions in sync with DFU_ALT_INFO_EMMC (see dfu.h)
  58. * 3. Keep 'bootloader' partition (U-Boot proper) start address in sync with
  59. * CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR (see common/spl/Kconfig)
  60. */
  61. #define PARTS_DEFAULT \
  62. /* Linux partitions */ \
  63. "uuid_disk=${uuid_gpt_disk};" \
  64. "name=bootloader,start=384K,size=1792K,uuid=${uuid_gpt_bootloader};" \
  65. "name=rootfs,start=2688K,size=-,uuid=${uuid_gpt_rootfs}\0" \
  66. /* Android partitions */ \
  67. "partitions_android=" \
  68. "uuid_disk=${uuid_gpt_disk};" \
  69. "name=xloader,start=128K,size=256K,uuid=${uuid_gpt_xloader};" \
  70. "name=bootloader,size=2048K,uuid=${uuid_gpt_bootloader};" \
  71. "name=uboot-env,start=2432K,size=256K,uuid=${uuid_gpt_reserved};" \
  72. "name=misc,size=128K,uuid=${uuid_gpt_misc};" \
  73. "name=boot_a,size=20M,uuid=${uuid_gpt_boot_a};" \
  74. "name=boot_b,size=20M,uuid=${uuid_gpt_boot_b};" \
  75. "name=dtbo_a,size=8M,uuid=${uuid_gpt_dtbo_a};" \
  76. "name=dtbo_b,size=8M,uuid=${uuid_gpt_dtbo_b};" \
  77. "name=vbmeta_a,size=64K,uuid=${uuid_gpt_vbmeta_a};" \
  78. "name=vbmeta_b,size=64K,uuid=${uuid_gpt_vbmeta_b};" \
  79. "name=recovery,size=64M,uuid=${uuid_gpt_recovery};" \
  80. "name=super,size=2560M,uuid=${uuid_gpt_super};" \
  81. "name=metadata,size=16M,uuid=${uuid_gpt_metadata};" \
  82. "name=userdata,size=-,uuid=${uuid_gpt_userdata}"
  83. #endif /* PARTS_DEFAULT */
  84. #if defined(CONFIG_CMD_AVB)
  85. #define AVB_VERIFY_CHECK "if run avb_verify; then " \
  86. "echo AVB verification OK.;" \
  87. "set bootargs $bootargs $avb_bootargs;" \
  88. "else " \
  89. "echo AVB verification failed.;" \
  90. "exit; fi;"
  91. #define AVB_VERIFY_CMD "avb_verify=avb init 1; avb verify $slot_suffix;\0"
  92. #else
  93. #define AVB_VERIFY_CHECK ""
  94. #define AVB_VERIFY_CMD ""
  95. #endif
  96. #define CONTROL_PARTITION "misc"
  97. #if defined(CONFIG_CMD_AB_SELECT)
  98. #define AB_SELECT_SLOT \
  99. "if part number mmc 1 " CONTROL_PARTITION " control_part_number; " \
  100. "then " \
  101. "echo " CONTROL_PARTITION \
  102. " partition number:${control_part_number};" \
  103. "ab_select slot_name mmc ${mmcdev}:${control_part_number};" \
  104. "else " \
  105. "echo " CONTROL_PARTITION " partition not found;" \
  106. "exit;" \
  107. "fi;" \
  108. "setenv slot_suffix _${slot_name};"
  109. #define AB_SELECT_ARGS \
  110. "setenv bootargs_ab androidboot.slot_suffix=${slot_suffix}; " \
  111. "echo A/B cmdline addition: ${bootargs_ab};" \
  112. "setenv bootargs ${bootargs} ${bootargs_ab};"
  113. #else
  114. #define AB_SELECT_SLOT ""
  115. #define AB_SELECT_ARGS ""
  116. #endif
  117. /*
  118. * Prepares complete device tree blob for current board (for Android boot).
  119. *
  120. * Boot image or recovery image should be loaded into $loadaddr prior to running
  121. * these commands. The logic of these commnads is next:
  122. *
  123. * 1. Read correct DTB for current SoC/board from boot image in $loadaddr
  124. * to $fdtaddr
  125. * 2. Merge all needed DTBO for current board from 'dtbo' partition into read
  126. * DTB
  127. * 3. User should provide $fdtaddr as 3rd argument to 'bootm'
  128. */
  129. #define PREPARE_FDT \
  130. "echo Preparing FDT...; " \
  131. "if test $board_name = am57xx_evm_reva3; then " \
  132. "echo \" Reading DTBO partition...\"; " \
  133. "part start mmc ${mmcdev} dtbo${slot_suffix} p_dtbo_start; " \
  134. "part size mmc ${mmcdev} dtbo${slot_suffix} p_dtbo_size; " \
  135. "mmc read ${dtboaddr} ${p_dtbo_start} ${p_dtbo_size}; " \
  136. "echo \" Reading DTB for AM57x EVM RevA3...\"; " \
  137. "abootimg get dtb --index=0 dtb_start dtb_size; " \
  138. "cp.b $dtb_start $fdtaddr $dtb_size; " \
  139. "fdt addr $fdtaddr 0x80000; " \
  140. "echo \" Applying DTBOs for AM57x EVM RevA3...\"; " \
  141. "adtimg addr $dtboaddr; " \
  142. "adtimg get dt --index=0 dtbo0_addr dtbo0_size; " \
  143. "fdt apply $dtbo0_addr; " \
  144. "adtimg get dt --index=1 dtbo1_addr dtbo1_size; " \
  145. "fdt apply $dtbo1_addr; " \
  146. "elif test $board_name = beagle_x15_revc; then " \
  147. "echo \" Reading DTB for Beagle X15 RevC...\"; " \
  148. "abootimg get dtb --index=0 dtb_start dtb_size; " \
  149. "cp.b $dtb_start $fdtaddr $dtb_size; " \
  150. "fdt addr $fdtaddr 0x80000; " \
  151. "else " \
  152. "echo Error: Android boot is not supported for $board_name; " \
  153. "exit; " \
  154. "fi; " \
  155. #define FASTBOOT_CMD \
  156. "echo Booting into fastboot ...; " \
  157. "fastboot " __stringify(CONFIG_FASTBOOT_USB_DEV) "; "
  158. #define DEFAULT_COMMON_BOOT_TI_ARGS \
  159. "console=" CONSOLEDEV ",115200n8\0" \
  160. "fdtfile=undefined\0" \
  161. "finduuid=part uuid mmc 0:2 uuid\0" \
  162. "usbtty=cdc_acm\0" \
  163. "vram=16M\0" \
  164. AVB_VERIFY_CMD \
  165. "partitions=" PARTS_DEFAULT "\0" \
  166. "optargs=\0" \
  167. "dofastboot=0\0" \
  168. "emmc_android_boot=" \
  169. "setenv mmcdev 1; " \
  170. "mmc dev $mmcdev; " \
  171. "mmc rescan; " \
  172. AB_SELECT_SLOT \
  173. "if bcb load " __stringify(CONFIG_FASTBOOT_FLASH_MMC_DEV) " " \
  174. CONTROL_PARTITION "; then " \
  175. "setenv ardaddr -; " \
  176. "if bcb test command = bootonce-bootloader; then " \
  177. "echo Android: Bootloader boot...; " \
  178. "bcb clear command; bcb store; " \
  179. FASTBOOT_CMD \
  180. "exit; " \
  181. "elif bcb test command = boot-recovery; then " \
  182. "echo Android: Recovery boot...; " \
  183. "setenv ardaddr $loadaddr;" \
  184. "setenv apart recovery; " \
  185. "else " \
  186. "echo Android: Normal boot...; " \
  187. "setenv ardaddr $loadaddr; " \
  188. "setenv apart boot${slot_suffix}; " \
  189. "fi; " \
  190. "else " \
  191. "echo Warning: BCB is corrupted or does not exist; " \
  192. "echo Android: Normal boot...; " \
  193. "fi; " \
  194. "setenv eval_bootargs setenv bootargs $bootargs; " \
  195. "run eval_bootargs; " \
  196. "setenv machid fe6; " \
  197. AVB_VERIFY_CHECK \
  198. AB_SELECT_ARGS \
  199. "if part start mmc $mmcdev $apart boot_start; then " \
  200. "part size mmc $mmcdev $apart boot_size; " \
  201. "mmc read $loadaddr $boot_start $boot_size; " \
  202. PREPARE_FDT \
  203. "bootm $loadaddr $ardaddr $fdtaddr; " \
  204. "else " \
  205. "echo $apart partition not found; " \
  206. "exit; " \
  207. "fi;\0"
  208. #define DEFAULT_FDT_TI_ARGS \
  209. "findfdt="\
  210. "if test $board_name = omap5_uevm; then " \
  211. "setenv fdtfile omap5-uevm.dtb; fi; " \
  212. "if test $board_name = dra7xx; then " \
  213. "setenv fdtfile dra7-evm.dtb; fi;" \
  214. "if test $board_name = dra72x-revc; then " \
  215. "setenv fdtfile dra72-evm-revc.dtb; fi;" \
  216. "if test $board_name = dra72x; then " \
  217. "setenv fdtfile dra72-evm.dtb; fi;" \
  218. "if test $board_name = dra71x; then " \
  219. "setenv fdtfile dra71-evm.dtb; fi;" \
  220. "if test $board_name = dra76x_acd; then " \
  221. "setenv fdtfile dra76-evm.dtb; fi;" \
  222. "if test $board_name = beagle_x15; then " \
  223. "setenv fdtfile am57xx-beagle-x15.dtb; fi;" \
  224. "if test $board_name = beagle_x15_revb1; then " \
  225. "setenv fdtfile am57xx-beagle-x15-revb1.dtb; fi;" \
  226. "if test $board_name = beagle_x15_revc; then " \
  227. "setenv fdtfile am57xx-beagle-x15-revc.dtb; fi;" \
  228. "if test $board_name = am5729_beagleboneai; then " \
  229. "setenv fdtfile am5729-beagleboneai.dtb; fi;" \
  230. "if test $board_name = am572x_idk; then " \
  231. "setenv fdtfile am572x-idk.dtb; fi;" \
  232. "if test $board_name = am574x_idk; then " \
  233. "setenv fdtfile am574x-idk.dtb; fi;" \
  234. "if test $board_name = am57xx_evm; then " \
  235. "setenv fdtfile am57xx-beagle-x15.dtb; fi;" \
  236. "if test $board_name = am57xx_evm_reva3; then " \
  237. "setenv fdtfile am57xx-beagle-x15.dtb; fi;" \
  238. "if test $board_name = am571x_idk; then " \
  239. "setenv fdtfile am571x-idk.dtb; fi;" \
  240. "if test $fdtfile = undefined; then " \
  241. "echo WARNING: Could not determine device tree to use; fi; \0"
  242. #define CONFIG_BOOTCOMMAND \
  243. "if test ${dofastboot} -eq 1; then " \
  244. "echo Boot fastboot requested, resetting dofastboot ...;" \
  245. "setenv dofastboot 0; saveenv;" \
  246. FASTBOOT_CMD \
  247. "fi;" \
  248. "if test ${boot_fit} -eq 1; then " \
  249. "run update_to_fit;" \
  250. "fi;" \
  251. "run findfdt; " \
  252. "run finduuid; " \
  253. "run distro_bootcmd;" \
  254. "run emmc_android_boot; " \
  255. ""
  256. #define BOOT_TARGET_DEVICES(func) \
  257. func(MMC, mmc, 0) \
  258. func(MMC, mmc, 1) \
  259. func(PXE, pxe, na) \
  260. func(DHCP, dhcp, na)
  261. #include <config_distro_bootcmd.h>
  262. #define CONFIG_EXTRA_ENV_SETTINGS \
  263. DEFAULT_LINUX_BOOT_ENV \
  264. DEFAULT_MMC_TI_ARGS \
  265. DEFAULT_FIT_TI_ARGS \
  266. DEFAULT_COMMON_BOOT_TI_ARGS \
  267. DEFAULT_FDT_TI_ARGS \
  268. DFUARGS \
  269. NETARGS \
  270. NANDARGS \
  271. BOOTENV
  272. /*
  273. * SPL related defines. The Public RAM memory map the ROM defines the
  274. * area between 0x40300000 and 0x4031E000 as a download area for OMAP5.
  275. * On DRA7xx/AM57XX the download area is between 0x40300000 and 0x4037E000.
  276. * We set CONFIG_SPL_DISPLAY_PRINT to have omap_rev_string() called and
  277. * print some information.
  278. */
  279. #ifdef CONFIG_TI_SECURE_DEVICE
  280. /*
  281. * For memory booting on HS parts, the first 4KB of the internal RAM is
  282. * reserved for secure world use and the flash loader image is
  283. * preceded by a secure certificate. The SPL will therefore run in internal
  284. * RAM from address 0x40301350 (0x40300000+0x1000(reserved)+0x350(cert)).
  285. */
  286. #define TI_OMAP5_SECURE_BOOT_RESV_SRAM_SZ 0x1000
  287. /* If no specific start address is specified then the secure EMIF
  288. * region will be placed at the end of the DDR space. In order to prevent
  289. * the main u-boot relocation from clobbering that memory and causing a
  290. * firewall violation, we tell u-boot that memory is protected RAM (PRAM)
  291. */
  292. #if (CONFIG_TI_SECURE_EMIF_REGION_START == 0)
  293. #define CONFIG_PRAM (CONFIG_TI_SECURE_EMIF_TOTAL_REGION_SIZE) >> 10
  294. #endif
  295. #else
  296. /*
  297. * For all booting on GP parts, the flash loader image is
  298. * downloaded into internal RAM at address 0x40300000.
  299. */
  300. #endif
  301. #define CONFIG_SYS_SPL_ARGS_ADDR (CONFIG_SYS_SDRAM_BASE + \
  302. (128 << 20))
  303. #ifdef CONFIG_SPL_BUILD
  304. #undef CONFIG_TIMER
  305. #endif
  306. #endif /* __CONFIG_TI_OMAP5_COMMON_H */