siemens-am33x-common.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * siemens am33x common board options
  4. * (C) Copyright 2013 Siemens Schweiz AG
  5. * (C) Heiko Schocher, DENX Software Engineering, hs@denx.de.
  6. *
  7. * Based on:
  8. * U-Boot file:/include/configs/am335x_evm.h
  9. *
  10. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
  11. */
  12. #ifndef __CONFIG_SIEMENS_AM33X_COMMON_H
  13. #define __CONFIG_SIEMENS_AM33X_COMMON_H
  14. #include <asm/arch/omap.h>
  15. #define CONFIG_DMA_COHERENT
  16. #define CONFIG_DMA_COHERENT_SIZE (1 << 20)
  17. /* commands to include */
  18. #ifndef CONFIG_SPL_BUILD
  19. #define CONFIG_ROOTPATH "/opt/eldk"
  20. #endif
  21. #define CONFIG_SYS_AUTOLOAD "yes"
  22. /* Clock Defines */
  23. #define V_OSCK 24000000 /* Clock output from T2 */
  24. #define V_SCLK (V_OSCK)
  25. /* We set the max number of command args high to avoid HUSH bugs. */
  26. #define CONFIG_SYS_MAXARGS 32
  27. /* Console I/O Buffer Size */
  28. #define CONFIG_SYS_CBSIZE 1024
  29. /* Boot Argument Buffer Size */
  30. #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
  31. /*
  32. * memtest works on 8 MB in DRAM after skipping 32MB from
  33. * start addr of ram disk
  34. */
  35. /* Physical Memory Map */
  36. #define PHYS_DRAM_1 0x80000000 /* DRAM Bank #1 */
  37. #define CONFIG_SYS_SDRAM_BASE PHYS_DRAM_1
  38. #define CONFIG_SYS_INIT_SP_ADDR (NON_SECURE_SRAM_END - \
  39. GENERATED_GBL_DATA_SIZE)
  40. /* Platform/Board specific defs */
  41. #define CONFIG_SYS_TIMERBASE 0x48040000 /* Use Timer2 */
  42. #define CONFIG_SYS_PTV 2 /* Divisor: 2^(PTV+1) => 8 */
  43. /* NS16550 Configuration */
  44. #define CONFIG_SYS_NS16550_SERIAL
  45. #define CONFIG_SYS_NS16550_CLK (48000000)
  46. #define CONFIG_SYS_NS16550_COM1 0x44e09000
  47. #define CONFIG_SYS_NS16550_COM4 0x481a6000
  48. /* I2C Configuration */
  49. /* Defines for SPL */
  50. #define CONFIG_SPL_MAX_SIZE (SRAM_SCRATCH_SPACE_ADDR - \
  51. CONFIG_SPL_TEXT_BASE)
  52. #define CONFIG_SPL_BSS_START_ADDR 0x80000000
  53. #define CONFIG_SPL_BSS_MAX_SIZE 0x80000 /* 512 KB */
  54. #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot.img"
  55. #define CONFIG_SYS_NAND_ECCPOS { 2, 3, 4, 5, 6, 7, 8, 9, \
  56. 10, 11, 12, 13, 14, 15, 16, 17, \
  57. 18, 19, 20, 21, 22, 23, 24, 25, \
  58. 26, 27, 28, 29, 30, 31, 32, 33, \
  59. 34, 35, 36, 37, 38, 39, 40, 41, \
  60. 42, 43, 44, 45, 46, 47, 48, 49, \
  61. 50, 51, 52, 53, 54, 55, 56, 57, }
  62. #define CONFIG_SYS_NAND_ECCSIZE 512
  63. #define CONFIG_SYS_NAND_ECCBYTES 14
  64. #define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH8_CODE_HW
  65. #define CONFIG_SYS_NAND_ECCSTEPS 4
  66. #define CONFIG_SYS_NAND_ECCTOTAL (CONFIG_SYS_NAND_ECCBYTES * \
  67. CONFIG_SYS_NAND_ECCSTEPS)
  68. #define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE
  69. /*
  70. * 1MB into the SDRAM to allow for SPL's bss at the beginning of SDRAM
  71. * 64 bytes before this address should be set aside for u-boot.img's
  72. * header. That is 0x800FFFC0--0x80100000 should not be used for any
  73. * other needs.
  74. */
  75. #define CONFIG_SYS_SPL_MALLOC_START 0x80208000
  76. #define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000
  77. /*
  78. * Since SPL did pll and ddr initialization for us,
  79. * we don't need to do it twice.
  80. */
  81. #ifndef CONFIG_SPL_BUILD
  82. /*
  83. * USB configuration
  84. */
  85. #define CONFIG_AM335X_USB0
  86. #define CONFIG_AM335X_USB0_MODE MUSB_PERIPHERAL
  87. #define CONFIG_AM335X_USB1
  88. #define CONFIG_AM335X_USB1_MODE MUSB_HOST
  89. /* USB DRACO ID as default */
  90. #define CONFIG_USBD_HS
  91. /* USB Device Firmware Update support */
  92. #define DFU_MANIFEST_POLL_TIMEOUT 25000
  93. #endif /* CONFIG_SPL_BUILD */
  94. /*
  95. * Default to using SPI for environment, etc. We have multiple copies
  96. * of SPL as the ROM will check these locations.
  97. * 0x0 - 0x20000 : First copy of SPL
  98. * 0x20000 - 0x40000 : Second copy of SPL
  99. * 0x40000 - 0x60000 : Third copy of SPL
  100. * 0x60000 - 0x80000 : Fourth copy of SPL
  101. * 0x80000 - 0xDF000 : U-Boot
  102. * 0xDF000 - 0xE0000 : U-Boot Environment
  103. * 0xE0000 - 0x442000 : Linux Kernel
  104. * 0x442000 - 0x800000 : Userland
  105. */
  106. #define CONFIG_NET_RETRY_COUNT 10
  107. /* NAND support */
  108. #ifdef CONFIG_MTD_RAW_NAND
  109. /* UBI Support */
  110. /* Commen environment */
  111. #define COMMON_ENV_DFU_ARGS "dfu_args=run bootargs_defaults;" \
  112. "setenv bootargs ${bootargs};" \
  113. "mtdparts default;" \
  114. "draco_led 1;" \
  115. "dfu 0 nand 0;" \
  116. "draco_led 0;\0" \
  117. #define COMMON_ENV_NAND_BOOT \
  118. "nand_boot=echo Booting from nand; " \
  119. "if test ${upgrade_available} -eq 1; then " \
  120. "if test ${bootcount} -gt ${bootlimit}; " \
  121. "then " \
  122. "setenv upgrade_available 0;" \
  123. "setenv ${partitionset_active} true;" \
  124. "if test -n ${A}; then " \
  125. "setenv partitionset_active B; " \
  126. "env delete A; " \
  127. "fi;" \
  128. "if test -n ${B}; then " \
  129. "setenv partitionset_active A; " \
  130. "env delete B; " \
  131. "fi;" \
  132. "saveenv; " \
  133. "fi;" \
  134. "fi;" \
  135. "echo set ${partitionset_active}...;" \
  136. "run nand_args; "
  137. #define COMMON_ENV_NAND_CMDS "flash_self=run nand_boot\0" \
  138. "flash_self_test=setenv testargs test; " \
  139. "run nand_boot\0" \
  140. "dfu_start=echo Preparing for dfu mode ...; " \
  141. "run dfu_args; \0"
  142. #define COMMON_ENV_SETTINGS \
  143. "verify=no \0" \
  144. "project_dir=targetdir\0" \
  145. "upgrade_available=0\0" \
  146. "altbootcmd=run bootcmd\0" \
  147. "partitionset_active=A\0" \
  148. "loadaddr=0x82000000\0" \
  149. "kloadaddr=0x81000000\0" \
  150. "script_addr=0x81900000\0" \
  151. "console=console=ttyMTD,mtdoops console=ttyO0,115200n8 panic=5\0" \
  152. "nfsopts=nolock rw\0" \
  153. "ip_method=none\0" \
  154. "bootenv=uEnv.txt\0" \
  155. "bootargs_defaults=setenv bootargs " \
  156. "console=${console} " \
  157. "${testargs} " \
  158. "${optargs}\0" \
  159. "siemens_help=echo; "\
  160. "echo Type 'run flash_self' to use kernel and root " \
  161. "filesystem on memory; echo Type 'run flash_self_test' to " \
  162. "use kernel and root filesystem on memory, boot in test " \
  163. "mode; echo Not ready yet: 'run flash_nfs' to use kernel " \
  164. "from memory and root filesystem over NFS; echo Type " \
  165. "'run net_nfs' to get Kernel over TFTP and mount root " \
  166. "filesystem over NFS; " \
  167. "echo Set partitionset_active variable to 'A' " \
  168. "or 'B' to select kernel and rootfs partition; " \
  169. "echo" \
  170. "\0"
  171. /*
  172. * Variant 1 partition layout
  173. * chip-size = 256MiB
  174. *| name | size | address area |
  175. *-------------------------------------------------------
  176. *| spl | 128.000 KiB | 0x 0..0x 1ffff |
  177. *| spl.backup1 | 128.000 KiB | 0x 20000..0x 3ffff |
  178. *| spl.backup2 | 128.000 KiB | 0x 40000..0x 5ffff |
  179. *| spl.backup3 | 128.000 KiB | 0x 60000..0x 7ffff |
  180. *| u-boot | 1.875 MiB | 0x 80000..0x 25ffff |
  181. *| uboot.env | 128.000 KiB | 0x 260000..0x 27ffff |
  182. *| kernel_a | 5.000 MiB | 0x 280000..0x 77ffff |
  183. *| kernel_b | 5.000 MiB | 0x 780000..0x c7ffff |
  184. *| mtdoops | 8.000 MiB | 0x c80000..0x 147ffff |
  185. *| rootfs | 235.500 MiB | 0x 1480000..0x fffffff |
  186. *-------------------------------------------------------
  187. "mtdparts=omap2-nand.0:" \
  188. "128k(spl)," \
  189. "128k(spl.backup1)," \
  190. "128k(spl.backup2)," \
  191. "128k(spl.backup3)," \
  192. "1920k(u-boot)," \
  193. "128k(uboot.env)," \
  194. "5120k(kernel_a)," \
  195. "5120k(kernel_b)," \
  196. "8192k(mtdoops)," \
  197. "-(rootfs)"
  198. */
  199. #define DFU_ALT_INFO_NAND_V1 \
  200. "spl part 0 1;" \
  201. "spl.backup1 part 0 2;" \
  202. "spl.backup2 part 0 3;" \
  203. "spl.backup3 part 0 4;" \
  204. "u-boot part 0 5;" \
  205. "u-boot.env part 0 6;" \
  206. "kernel_a part 0 7;" \
  207. "kernel_b part 0 8;" \
  208. "rootfs partubi 0 10"
  209. #define CONFIG_ENV_SETTINGS_NAND_V1 \
  210. "nand_active_ubi_vol=rootfs_a\0" \
  211. "nand_active_ubi_vol_A=rootfs_a\0" \
  212. "nand_active_ubi_vol_B=rootfs_b\0" \
  213. "nand_root_fs_type=ubifs rootwait=1\0" \
  214. "nand_src_addr=0x280000\0" \
  215. "nand_src_addr_A=0x280000\0" \
  216. "nand_src_addr_B=0x780000\0" \
  217. "nand_args=run bootargs_defaults;" \
  218. "mtdparts default;" \
  219. "setenv ${partitionset_active} true;" \
  220. "if test -n ${A}; then " \
  221. "setenv nand_active_ubi_vol ${nand_active_ubi_vol_A};" \
  222. "setenv nand_src_addr ${nand_src_addr_A};" \
  223. "fi;" \
  224. "if test -n ${B}; then " \
  225. "setenv nand_active_ubi_vol ${nand_active_ubi_vol_B};" \
  226. "setenv nand_src_addr ${nand_src_addr_B};" \
  227. "fi;" \
  228. "setenv nand_root ubi0:${nand_active_ubi_vol} rw " \
  229. "ubi.mtd=9,${ubi_off};" \
  230. "setenv bootargs ${bootargs} " \
  231. "root=${nand_root} noinitrd ${mtdparts} " \
  232. "rootfstype=${nand_root_fs_type} ip=${ip_method} " \
  233. "console=ttyMTD,mtdoops console=ttyO0,115200n8 mtdoops.mtddev" \
  234. "=mtdoops\0" \
  235. COMMON_ENV_DFU_ARGS \
  236. "dfu_alt_info=" DFU_ALT_INFO_NAND_V1 "\0" \
  237. COMMON_ENV_NAND_BOOT \
  238. "nand read.i ${kloadaddr} ${nand_src_addr} " \
  239. "${nand_img_size}; bootm ${kloadaddr}\0" \
  240. COMMON_ENV_NAND_CMDS
  241. #define CONFIG_ENV_SETTINGS_V1 \
  242. COMMON_ENV_SETTINGS \
  243. "net_args=run bootargs_defaults;" \
  244. "mtdparts default;" \
  245. "setenv bootfile ${project_dir}/kernel/uImage;" \
  246. "setenv rootpath /home/projects/${project_dir}/rootfs;" \
  247. "setenv bootargs ${bootargs} " \
  248. "root=/dev/nfs ${mtdparts} " \
  249. "nfsroot=${serverip}:${rootpath},${nfsopts} " \
  250. "ip=${ipaddr}:${serverip}:" \
  251. "${gatewayip}:${netmask}:${hostname}:eth0:off\0" \
  252. "net_nfs=echo Booting from network ...; " \
  253. "run net_args; " \
  254. "tftpboot ${kloadaddr} ${serverip}:${bootfile}; " \
  255. "bootm ${kloadaddr}\0"
  256. /*
  257. * Variant 2 partition layout (default)
  258. * chip-size = 256MiB or 512 MiB
  259. *| name | size | address area |
  260. *-------------------------------------------------------
  261. *| spl | 128.000 KiB | 0x 0..0x 1ffff |
  262. *| spl.backup1 | 128.000 KiB | 0x 20000..0x 3ffff |
  263. *| spl.backup2 | 128.000 KiB | 0x 40000..0x 5ffff |
  264. *| spl.backup3 | 128.000 KiB | 0x 60000..0x 7ffff |
  265. *| u-boot | 1.875 MiB | 0x 80000..0x 25ffff |
  266. *| uboot.env0 | 512.000 KiB | 0x 260000..0x 2Dffff |
  267. *| uboot.env1 | 512.000 KiB | 0x 2E0000..0x 35ffff |
  268. *| mtdoops | 512.000 KiB | 0x 360000..0x 3dffff |
  269. *| (256) rootfs | 252.125 MiB | 0x 3E0000..0x fffffff |
  270. *| (512) rootfs | 508.125 MiB | 0x 3E0000..0x1fffffff |
  271. *-------------------------------------------------------
  272. */
  273. #define DFU_ALT_INFO_NAND_V2 \
  274. "spl part 0 1;" \
  275. "spl.backup1 part 0 2;" \
  276. "spl.backup2 part 0 3;" \
  277. "spl.backup3 part 0 4;" \
  278. "u-boot part 0 5;" \
  279. "u-boot.env0 part 0 6;" \
  280. "u-boot.env1 part 0 7;" \
  281. "rootfs partubi 0 9" \
  282. #define CONFIG_ENV_SETTINGS_NAND_V2 \
  283. "nand_active_ubi_vol=rootfs_a\0" \
  284. "rootfs_name=rootfs\0" \
  285. "kernel_name=uImage\0"\
  286. "nand_root_fs_type=ubifs rootwait=1\0" \
  287. "nand_args=run bootargs_defaults;" \
  288. "mtdparts default;" \
  289. "setenv ${partitionset_active} true;" \
  290. "if test -n ${A}; then " \
  291. "setenv nand_active_ubi_vol ${rootfs_name}_a;" \
  292. "fi;" \
  293. "if test -n ${B}; then " \
  294. "setenv nand_active_ubi_vol ${rootfs_name}_b;" \
  295. "fi;" \
  296. "setenv nand_root ubi0:${nand_active_ubi_vol} rw " \
  297. "ubi.mtd=rootfs,2048;" \
  298. "setenv bootargs ${bootargs} " \
  299. "root=${nand_root} noinitrd ${mtdparts} " \
  300. "rootfstype=${nand_root_fs_type} ip=${ip_method} " \
  301. "console=ttyMTD,mtdoops console=ttyO0,115200n8 mtdoops.mtddev" \
  302. "=mtdoops\0" \
  303. COMMON_ENV_DFU_ARGS \
  304. "dfu_alt_info=" DFU_ALT_INFO_NAND_V2 "\0" \
  305. COMMON_ENV_NAND_BOOT \
  306. "ubi part rootfs ${ubi_off};" \
  307. "ubifsmount ubi0:${nand_active_ubi_vol};" \
  308. "ubifsload ${kloadaddr} boot/${kernel_name};" \
  309. "ubifsload ${loadaddr} boot/${dtb_name}.dtb;" \
  310. "bootm ${kloadaddr} - ${loadaddr}\0" \
  311. "nand_boot_backup=ubifsload ${loadaddr} boot/am335x-draco.dtb;" \
  312. "bootm ${kloadaddr} - ${loadaddr}\0" \
  313. COMMON_ENV_NAND_CMDS
  314. #define CONFIG_ENV_SETTINGS_V2 \
  315. COMMON_ENV_SETTINGS \
  316. "net_args=run bootargs_defaults;" \
  317. "mtdparts default;" \
  318. "setenv bootfile ${project_dir}/kernel/uImage;" \
  319. "setenv bootdtb ${project_dir}/kernel/dtb;" \
  320. "setenv rootpath /home/projects/${project_dir}/rootfs;" \
  321. "setenv bootargs ${bootargs} " \
  322. "root=/dev/nfs ${mtdparts} " \
  323. "nfsroot=${serverip}:${rootpath},${nfsopts} " \
  324. "ip=${ipaddr}:${serverip}:" \
  325. "${gatewayip}:${netmask}:${hostname}:eth0:off\0" \
  326. "net_nfs=echo Booting from network ...; " \
  327. "run net_args; " \
  328. "tftpboot ${kloadaddr} ${serverip}:${bootfile}; " \
  329. "tftpboot ${loadaddr} ${serverip}:${bootdtb}; " \
  330. "bootm ${kloadaddr} - ${loadaddr}\0"
  331. /*
  332. * Variant 3 partition layout
  333. * chip-size = 512MiB
  334. *| name | size | address area |
  335. *-------------------------------------------------------
  336. *| spl | 128.000 KiB | 0x 0..0x 1ffff |
  337. *| spl.backup1 | 128.000 KiB | 0x 20000..0x 3ffff |
  338. *| spl.backup2 | 128.000 KiB | 0x 40000..0x 5ffff |
  339. *| spl.backup3 | 128.000 KiB | 0x 60000..0x 7ffff |
  340. *| u-boot | 1.875 MiB | 0x 80000..0x 25ffff |
  341. *| uboot.env0 | 512.000 KiB | 0x 260000..0x 2Dffff |
  342. *| uboot.env1 | 512.000 KiB | 0x 2E0000..0x 35ffff |
  343. *| rootfs | 300.000 MiB | 0x 360000..0x12f5ffff |
  344. *| mtdoops | 512.000 KiB | 0x12f60000..0x12fdffff |
  345. *|configuration | 104.125 MiB | 0x12fe0000..0x1fffffff |
  346. *-------------------------------------------------------
  347. "mtdparts=omap2-nand.0:" \
  348. "128k(spl)," \
  349. "128k(spl.backup1)," \
  350. "128k(spl.backup2)," \
  351. "128k(spl.backup3)," \
  352. "1920k(u-boot)," \
  353. "512k(u-boot.env0)," \
  354. "512k(u-boot.env1)," \
  355. "300m(rootfs)," \
  356. "512k(mtdoops)," \
  357. "-(configuration)"
  358. */
  359. #define CONFIG_SYS_NAND_BASE (0x08000000) /* physical address */
  360. /* to access nand at */
  361. /* CS0 */
  362. #define CONFIG_SYS_MAX_NAND_DEVICE 1 /* Max number of NAND
  363. devices */
  364. #if !defined(CONFIG_SPI_BOOT)
  365. #define CONFIG_SYS_ENV_SECT_SIZE (128 << 10) /* 128 KiB */
  366. #endif
  367. #endif
  368. /* Reboot after 60 sec if bootcmd fails */
  369. #define CONFIG_RESET_TO_RETRY
  370. #define CONFIG_BOOT_RETRY_TIME 60
  371. #endif /* ! __CONFIG_SIEMENS_AM33X_COMMON_H */