siemens-am33x-common.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  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
  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 CONFIG_SYS_DFU_DATA_BUF_SIZE (1 << 20)
  115. #define DFU_MANIFEST_POLL_TIMEOUT 25000
  116. #endif /* CONFIG_SPL_BUILD */
  117. /*
  118. * Default to using SPI for environment, etc. We have multiple copies
  119. * of SPL as the ROM will check these locations.
  120. * 0x0 - 0x20000 : First copy of SPL
  121. * 0x20000 - 0x40000 : Second copy of SPL
  122. * 0x40000 - 0x60000 : Third copy of SPL
  123. * 0x60000 - 0x80000 : Fourth copy of SPL
  124. * 0x80000 - 0xDF000 : U-Boot
  125. * 0xDF000 - 0xE0000 : U-Boot Environment
  126. * 0xE0000 - 0x442000 : Linux Kernel
  127. * 0x442000 - 0x800000 : Userland
  128. */
  129. #define CONFIG_NET_RETRY_COUNT 10
  130. /* NAND support */
  131. #ifdef CONFIG_MTD_RAW_NAND
  132. /* UBI Support */
  133. /* Commen environment */
  134. #define COMMON_ENV_DFU_ARGS "dfu_args=run bootargs_defaults;" \
  135. "setenv bootargs ${bootargs};" \
  136. "mtdparts default;" \
  137. "draco_led 1;" \
  138. "dfu 0 nand 0;" \
  139. "draco_led 0;\0" \
  140. #define COMMON_ENV_NAND_BOOT \
  141. "nand_boot=echo Booting from nand; " \
  142. "if test ${upgrade_available} -eq 1; then " \
  143. "if test ${bootcount} -gt ${bootlimit}; " \
  144. "then " \
  145. "setenv upgrade_available 0;" \
  146. "setenv ${partitionset_active} true;" \
  147. "if test -n ${A}; then " \
  148. "setenv partitionset_active B; " \
  149. "env delete A; " \
  150. "fi;" \
  151. "if test -n ${B}; then " \
  152. "setenv partitionset_active A; " \
  153. "env delete B; " \
  154. "fi;" \
  155. "saveenv; " \
  156. "fi;" \
  157. "fi;" \
  158. "echo set ${partitionset_active}...;" \
  159. "run nand_args; "
  160. #define COMMON_ENV_NAND_CMDS "flash_self=run nand_boot\0" \
  161. "flash_self_test=setenv testargs test; " \
  162. "run nand_boot\0" \
  163. "dfu_start=echo Preparing for dfu mode ...; " \
  164. "run dfu_args; \0"
  165. #define COMMON_ENV_SETTINGS \
  166. "verify=no \0" \
  167. "project_dir=targetdir\0" \
  168. "upgrade_available=0\0" \
  169. "altbootcmd=run bootcmd\0" \
  170. "partitionset_active=A\0" \
  171. "loadaddr=0x82000000\0" \
  172. "kloadaddr=0x81000000\0" \
  173. "script_addr=0x81900000\0" \
  174. "console=console=ttyMTD,mtdoops console=ttyO0,115200n8 panic=5\0" \
  175. "nfsopts=nolock rw\0" \
  176. "ip_method=none\0" \
  177. "bootenv=uEnv.txt\0" \
  178. "bootargs_defaults=setenv bootargs " \
  179. "console=${console} " \
  180. "${testargs} " \
  181. "${optargs}\0" \
  182. "siemens_help=echo; "\
  183. "echo Type 'run flash_self' to use kernel and root " \
  184. "filesystem on memory; echo Type 'run flash_self_test' to " \
  185. "use kernel and root filesystem on memory, boot in test " \
  186. "mode; echo Not ready yet: 'run flash_nfs' to use kernel " \
  187. "from memory and root filesystem over NFS; echo Type " \
  188. "'run net_nfs' to get Kernel over TFTP and mount root " \
  189. "filesystem over NFS; " \
  190. "echo Set partitionset_active variable to 'A' " \
  191. "or 'B' to select kernel and rootfs partition; " \
  192. "echo" \
  193. "\0"
  194. /*
  195. * Variant 1 partition layout
  196. * chip-size = 256MiB
  197. *| name | size | address area |
  198. *-------------------------------------------------------
  199. *| spl | 128.000 KiB | 0x 0..0x 1ffff |
  200. *| spl.backup1 | 128.000 KiB | 0x 20000..0x 3ffff |
  201. *| spl.backup2 | 128.000 KiB | 0x 40000..0x 5ffff |
  202. *| spl.backup3 | 128.000 KiB | 0x 60000..0x 7ffff |
  203. *| u-boot | 1.875 MiB | 0x 80000..0x 25ffff |
  204. *| uboot.env | 128.000 KiB | 0x 260000..0x 27ffff |
  205. *| kernel_a | 5.000 MiB | 0x 280000..0x 77ffff |
  206. *| kernel_b | 5.000 MiB | 0x 780000..0x c7ffff |
  207. *| mtdoops | 8.000 MiB | 0x c80000..0x 147ffff |
  208. *| rootfs | 235.500 MiB | 0x 1480000..0x fffffff |
  209. *-------------------------------------------------------
  210. "mtdparts=omap2-nand.0:" \
  211. "128k(spl)," \
  212. "128k(spl.backup1)," \
  213. "128k(spl.backup2)," \
  214. "128k(spl.backup3)," \
  215. "1920k(u-boot)," \
  216. "128k(uboot.env)," \
  217. "5120k(kernel_a)," \
  218. "5120k(kernel_b)," \
  219. "8192k(mtdoops)," \
  220. "-(rootfs)"
  221. */
  222. #define DFU_ALT_INFO_NAND_V1 \
  223. "spl part 0 1;" \
  224. "spl.backup1 part 0 2;" \
  225. "spl.backup2 part 0 3;" \
  226. "spl.backup3 part 0 4;" \
  227. "u-boot part 0 5;" \
  228. "u-boot.env part 0 6;" \
  229. "kernel_a part 0 7;" \
  230. "kernel_b part 0 8;" \
  231. "rootfs partubi 0 10"
  232. #define CONFIG_ENV_SETTINGS_NAND_V1 \
  233. "nand_active_ubi_vol=rootfs_a\0" \
  234. "nand_active_ubi_vol_A=rootfs_a\0" \
  235. "nand_active_ubi_vol_B=rootfs_b\0" \
  236. "nand_root_fs_type=ubifs rootwait=1\0" \
  237. "nand_src_addr=0x280000\0" \
  238. "nand_src_addr_A=0x280000\0" \
  239. "nand_src_addr_B=0x780000\0" \
  240. "nand_args=run bootargs_defaults;" \
  241. "mtdparts default;" \
  242. "setenv ${partitionset_active} true;" \
  243. "if test -n ${A}; then " \
  244. "setenv nand_active_ubi_vol ${nand_active_ubi_vol_A};" \
  245. "setenv nand_src_addr ${nand_src_addr_A};" \
  246. "fi;" \
  247. "if test -n ${B}; then " \
  248. "setenv nand_active_ubi_vol ${nand_active_ubi_vol_B};" \
  249. "setenv nand_src_addr ${nand_src_addr_B};" \
  250. "fi;" \
  251. "setenv nand_root ubi0:${nand_active_ubi_vol} rw " \
  252. "ubi.mtd=9,${ubi_off};" \
  253. "setenv bootargs ${bootargs} " \
  254. "root=${nand_root} noinitrd ${mtdparts} " \
  255. "rootfstype=${nand_root_fs_type} ip=${ip_method} " \
  256. "console=ttyMTD,mtdoops console=ttyO0,115200n8 mtdoops.mtddev" \
  257. "=mtdoops\0" \
  258. COMMON_ENV_DFU_ARGS \
  259. "dfu_alt_info=" DFU_ALT_INFO_NAND_V1 "\0" \
  260. COMMON_ENV_NAND_BOOT \
  261. "nand read.i ${kloadaddr} ${nand_src_addr} " \
  262. "${nand_img_size}; bootm ${kloadaddr}\0" \
  263. COMMON_ENV_NAND_CMDS
  264. #define CONFIG_ENV_SETTINGS_V1 \
  265. COMMON_ENV_SETTINGS \
  266. "net_args=run bootargs_defaults;" \
  267. "mtdparts default;" \
  268. "setenv bootfile ${project_dir}/kernel/uImage;" \
  269. "setenv rootpath /home/projects/${project_dir}/rootfs;" \
  270. "setenv bootargs ${bootargs} " \
  271. "root=/dev/nfs ${mtdparts} " \
  272. "nfsroot=${serverip}:${rootpath},${nfsopts} " \
  273. "ip=${ipaddr}:${serverip}:" \
  274. "${gatewayip}:${netmask}:${hostname}:eth0:off\0" \
  275. "net_nfs=echo Booting from network ...; " \
  276. "run net_args; " \
  277. "tftpboot ${kloadaddr} ${serverip}:${bootfile}; " \
  278. "bootm ${kloadaddr}\0"
  279. /*
  280. * Variant 2 partition layout (default)
  281. * chip-size = 256MiB or 512 MiB
  282. *| name | size | address area |
  283. *-------------------------------------------------------
  284. *| spl | 128.000 KiB | 0x 0..0x 1ffff |
  285. *| spl.backup1 | 128.000 KiB | 0x 20000..0x 3ffff |
  286. *| spl.backup2 | 128.000 KiB | 0x 40000..0x 5ffff |
  287. *| spl.backup3 | 128.000 KiB | 0x 60000..0x 7ffff |
  288. *| u-boot | 1.875 MiB | 0x 80000..0x 25ffff |
  289. *| uboot.env0 | 512.000 KiB | 0x 260000..0x 2Dffff |
  290. *| uboot.env1 | 512.000 KiB | 0x 2E0000..0x 35ffff |
  291. *| mtdoops | 512.000 KiB | 0x 360000..0x 3dffff |
  292. *| (256) rootfs | 252.125 MiB | 0x 3E0000..0x fffffff |
  293. *| (512) rootfs | 508.125 MiB | 0x 3E0000..0x1fffffff |
  294. *-------------------------------------------------------
  295. */
  296. #define DFU_ALT_INFO_NAND_V2 \
  297. "spl part 0 1;" \
  298. "spl.backup1 part 0 2;" \
  299. "spl.backup2 part 0 3;" \
  300. "spl.backup3 part 0 4;" \
  301. "u-boot part 0 5;" \
  302. "u-boot.env0 part 0 6;" \
  303. "u-boot.env1 part 0 7;" \
  304. "rootfs partubi 0 9" \
  305. #define CONFIG_ENV_SETTINGS_NAND_V2 \
  306. "nand_active_ubi_vol=rootfs_a\0" \
  307. "rootfs_name=rootfs\0" \
  308. "kernel_name=uImage\0"\
  309. "nand_root_fs_type=ubifs rootwait=1\0" \
  310. "nand_args=run bootargs_defaults;" \
  311. "mtdparts default;" \
  312. "setenv ${partitionset_active} true;" \
  313. "if test -n ${A}; then " \
  314. "setenv nand_active_ubi_vol ${rootfs_name}_a;" \
  315. "fi;" \
  316. "if test -n ${B}; then " \
  317. "setenv nand_active_ubi_vol ${rootfs_name}_b;" \
  318. "fi;" \
  319. "setenv nand_root ubi0:${nand_active_ubi_vol} rw " \
  320. "ubi.mtd=rootfs,2048;" \
  321. "setenv bootargs ${bootargs} " \
  322. "root=${nand_root} noinitrd ${mtdparts} " \
  323. "rootfstype=${nand_root_fs_type} ip=${ip_method} " \
  324. "console=ttyMTD,mtdoops console=ttyO0,115200n8 mtdoops.mtddev" \
  325. "=mtdoops\0" \
  326. COMMON_ENV_DFU_ARGS \
  327. "dfu_alt_info=" DFU_ALT_INFO_NAND_V2 "\0" \
  328. COMMON_ENV_NAND_BOOT \
  329. "ubi part rootfs ${ubi_off};" \
  330. "ubifsmount ubi0:${nand_active_ubi_vol};" \
  331. "ubifsload ${kloadaddr} boot/${kernel_name};" \
  332. "ubifsload ${loadaddr} boot/${dtb_name}.dtb;" \
  333. "bootm ${kloadaddr} - ${loadaddr}\0" \
  334. "nand_boot_backup=ubifsload ${loadaddr} boot/am335x-draco.dtb;" \
  335. "bootm ${kloadaddr} - ${loadaddr}\0" \
  336. COMMON_ENV_NAND_CMDS
  337. #define CONFIG_ENV_SETTINGS_V2 \
  338. COMMON_ENV_SETTINGS \
  339. "net_args=run bootargs_defaults;" \
  340. "mtdparts default;" \
  341. "setenv bootfile ${project_dir}/kernel/uImage;" \
  342. "setenv bootdtb ${project_dir}/kernel/dtb;" \
  343. "setenv rootpath /home/projects/${project_dir}/rootfs;" \
  344. "setenv bootargs ${bootargs} " \
  345. "root=/dev/nfs ${mtdparts} " \
  346. "nfsroot=${serverip}:${rootpath},${nfsopts} " \
  347. "ip=${ipaddr}:${serverip}:" \
  348. "${gatewayip}:${netmask}:${hostname}:eth0:off\0" \
  349. "net_nfs=echo Booting from network ...; " \
  350. "run net_args; " \
  351. "tftpboot ${kloadaddr} ${serverip}:${bootfile}; " \
  352. "tftpboot ${loadaddr} ${serverip}:${bootdtb}; " \
  353. "bootm ${kloadaddr} - ${loadaddr}\0"
  354. /*
  355. * Variant 3 partition layout
  356. * chip-size = 512MiB
  357. *| name | size | address area |
  358. *-------------------------------------------------------
  359. *| spl | 128.000 KiB | 0x 0..0x 1ffff |
  360. *| spl.backup1 | 128.000 KiB | 0x 20000..0x 3ffff |
  361. *| spl.backup2 | 128.000 KiB | 0x 40000..0x 5ffff |
  362. *| spl.backup3 | 128.000 KiB | 0x 60000..0x 7ffff |
  363. *| u-boot | 1.875 MiB | 0x 80000..0x 25ffff |
  364. *| uboot.env0 | 512.000 KiB | 0x 260000..0x 2Dffff |
  365. *| uboot.env1 | 512.000 KiB | 0x 2E0000..0x 35ffff |
  366. *| rootfs | 300.000 MiB | 0x 360000..0x12f5ffff |
  367. *| mtdoops | 512.000 KiB | 0x12f60000..0x12fdffff |
  368. *|configuration | 104.125 MiB | 0x12fe0000..0x1fffffff |
  369. *-------------------------------------------------------
  370. "mtdparts=omap2-nand.0:" \
  371. "128k(spl)," \
  372. "128k(spl.backup1)," \
  373. "128k(spl.backup2)," \
  374. "128k(spl.backup3)," \
  375. "1920k(u-boot)," \
  376. "512k(u-boot.env0)," \
  377. "512k(u-boot.env1)," \
  378. "300m(rootfs)," \
  379. "512k(mtdoops)," \
  380. "-(configuration)"
  381. */
  382. #define CONFIG_SYS_NAND_BASE (0x08000000) /* physical address */
  383. /* to access nand at */
  384. /* CS0 */
  385. #define CONFIG_SYS_MAX_NAND_DEVICE 1 /* Max number of NAND
  386. devices */
  387. #if !defined(CONFIG_SPI_BOOT)
  388. #define CONFIG_SYS_ENV_SECT_SIZE (128 << 10) /* 128 KiB */
  389. #endif
  390. #endif
  391. /* Reboot after 60 sec if bootcmd fails */
  392. #define CONFIG_RESET_TO_RETRY
  393. #define CONFIG_BOOT_RETRY_TIME 60
  394. #endif /* ! __CONFIG_SIEMENS_AM33X_COMMON_H */