siemens-am33x-common.h 14 KB

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