siemens-am33x-common.h 14 KB

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