am335x_evm.h_20180302 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. /*
  2. * am335x_evm.h
  3. *
  4. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License as
  8. * published by the Free Software Foundation version 2.
  9. *
  10. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
  11. * kind, whether express or implied; without even the implied warranty
  12. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #ifndef __CONFIG_AM335X_EVM_H
  16. #define __CONFIG_AM335X_EVM_H
  17. #include <configs/ti_am335x_common.h>
  18. #ifndef CONFIG_SPL_BUILD
  19. # define CONFIG_TIMESTAMP
  20. # define CONFIG_LZO
  21. #endif
  22. #define CONFIG_SYS_BOOTM_LEN (16 << 20)
  23. #define MACH_TYPE_TIAM335EVM 3589 /* Until the next sync */
  24. #define CONFIG_MACH_TYPE MACH_TYPE_TIAM335EVM
  25. #define CONFIG_BOARD_LATE_INIT
  26. /* Clock Defines */
  27. #define V_OSCK 24000000 /* Clock output from T2 */
  28. #define V_SCLK (V_OSCK)
  29. /* Custom script for NOR */
  30. #define CONFIG_SYS_LDSCRIPT "board/ti/am335x/u-boot.lds"
  31. /* Always 128 KiB env size */
  32. #define CONFIG_ENV_SIZE (128 << 10)
  33. /* Enhance our eMMC support / experience. */
  34. #define CONFIG_CMD_GPT
  35. #define CONFIG_EFI_PARTITION
  36. #ifdef CONFIG_NAND
  37. #define NANDARGS \
  38. "mtdids=" MTDIDS_DEFAULT "\0" \
  39. "mtdparts=" MTDPARTS_DEFAULT "\0" \
  40. "nandargs=setenv bootargs console=${console} " \
  41. "${optargs} " \
  42. "root=${nandroot} " \
  43. "rootfstype=${nandrootfstype}\0" \
  44. "nandroot=ubi0:rootfs rw ubi.mtd=NAND.file-system,2048\0" \
  45. "nandrootfstype=ubifs rootwait=1\0" \
  46. "nandboot=echo Booting from nand ...; " \
  47. "run nandargs; " \
  48. "nand read ${fdtaddr} NAND.u-boot-spl-os; " \
  49. "nand read ${loadaddr} NAND.kernel; " \
  50. "bootz ${loadaddr} - ${fdtaddr}\0"
  51. #else
  52. #define NANDARGS ""
  53. #endif
  54. #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
  55. #define BOOTENV_DEV_LEGACY_MMC(devtypeu, devtypel, instance) \
  56. "bootcmd_" #devtypel #instance "=" \
  57. "setenv mmcdev " #instance"; "\
  58. "setenv bootpart " #instance":2 ; "\
  59. "run mmcboot\0"
  60. #define BOOTENV_DEV_NAME_LEGACY_MMC(devtypeu, devtypel, instance) \
  61. #devtypel #instance " "
  62. #define BOOTENV_DEV_NAND(devtypeu, devtypel, instance) \
  63. "bootcmd_" #devtypel "=" \
  64. "run nandboot\0"
  65. #define BOOTENV_DEV_NAME_NAND(devtypeu, devtypel, instance) \
  66. #devtypel #instance " "
  67. #define BOOT_TARGET_DEVICES(func) \
  68. func(MMC, mmc, 0) \
  69. func(LEGACY_MMC, legacy_mmc, 0) \
  70. func(MMC, mmc, 1) \
  71. func(LEGACY_MMC, legacy_mmc, 1) \
  72. func(NAND, nand, 0) \
  73. func(PXE, pxe, na) \
  74. func(DHCP, dhcp, na)
  75. #define CONFIG_BOOTCOMMAND \
  76. "if test ${boot_fit} -eq 1; then " \
  77. "run update_to_fit;" \
  78. "fi;" \
  79. "run findfdt; " \
  80. "run init_console; " \
  81. "run envboot; " \
  82. "run distro_bootcmd"
  83. #include <config_distro_bootcmd.h>
  84. #ifndef CONFIG_SPL_BUILD
  85. #include <environment/ti/dfu.h>
  86. #include <environment/ti/mmc.h>
  87. #define CONFIG_EXTRA_ENV_SETTINGS \
  88. DEFAULT_LINUX_BOOT_ENV \
  89. DEFAULT_MMC_TI_ARGS \
  90. DEFAULT_FIT_TI_ARGS \
  91. "bootpart=0:2\0" \
  92. "bootdir=/boot\0" \
  93. "bootfile=zImage\0" \
  94. "fdtfile=undefined\0" \
  95. "console=ttyO0,115200n8\0" \
  96. "partitions=" \
  97. "uuid_disk=${uuid_gpt_disk};" \
  98. "name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}\0" \
  99. "optargs=\0" \
  100. "ramroot=/dev/ram0 rw\0" \
  101. "ramrootfstype=ext2\0" \
  102. "spiroot=/dev/mtdblock4 rw\0" \
  103. "spirootfstype=jffs2\0" \
  104. "spisrcaddr=0xe0000\0" \
  105. "spiimgsize=0x362000\0" \
  106. "spibusno=0\0" \
  107. "spiargs=setenv bootargs console=${console} " \
  108. "${optargs} " \
  109. "root=${spiroot} " \
  110. "rootfstype=${spirootfstype}\0" \
  111. "ramargs=setenv bootargs console=${console} " \
  112. "${optargs} " \
  113. "root=${ramroot} " \
  114. "rootfstype=${ramrootfstype}\0" \
  115. "loadramdisk=load mmc ${mmcdev} ${rdaddr} ramdisk.gz\0" \
  116. "spiboot=echo Booting from spi ...; " \
  117. "run spiargs; " \
  118. "sf probe ${spibusno}:0; " \
  119. "sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; " \
  120. "bootz ${loadaddr}\0" \
  121. "ramboot=echo Booting from ramdisk ...; " \
  122. "run ramargs; " \
  123. "bootz ${loadaddr} ${rdaddr} ${fdtaddr}\0" \
  124. "findfdt="\
  125. "if test $board_name = A335BONE; then " \
  126. "setenv fdtfile am335x-bone.dtb; fi; " \
  127. "if test $board_name = A335BNLT; then " \
  128. "setenv fdtfile am335x-boneblack.dtb; fi; " \
  129. "if test $board_name = BBG1; then " \
  130. "setenv fdtfile am335x-bonegreen.dtb; fi; " \
  131. "if test $board_name = A33515BB; then " \
  132. "setenv fdtfile am335x-evm.dtb; fi; " \
  133. "if test $board_name = A335X_SK; then " \
  134. "setenv fdtfile am335x-evmsk.dtb; fi; " \
  135. "if test $board_name = A335_ICE; then " \
  136. "setenv fdtfile am335x-icev2.dtb; fi; " \
  137. "if test $fdtfile = undefined; then " \
  138. "echo WARNING: Could not determine device tree to use; fi; \0" \
  139. "init_console=" \
  140. "if test $board_name = A335_ICE; then "\
  141. "setenv console ttyO3,115200n8;" \
  142. "else " \
  143. "setenv console ttyO0,115200n8;" \
  144. "fi;\0" \
  145. NANDARGS \
  146. NETARGS \
  147. DFUARGS \
  148. BOOTENV
  149. #endif
  150. /* NS16550 Configuration */
  151. #define CONFIG_SYS_NS16550_COM1 0x44e09000 /* Base EVM has UART0 */
  152. #define CONFIG_SYS_NS16550_COM2 0x48022000 /* UART1 */
  153. #define CONFIG_SYS_NS16550_COM3 0x48024000 /* UART2 */
  154. #define CONFIG_SYS_NS16550_COM4 0x481a6000 /* UART3 */
  155. #define CONFIG_SYS_NS16550_COM5 0x481a8000 /* UART4 */
  156. #define CONFIG_SYS_NS16550_COM6 0x481aa000 /* UART5 */
  157. #define CONFIG_BAUDRATE 115200
  158. #define CONFIG_CMD_EEPROM
  159. #define CONFIG_ENV_EEPROM_IS_ON_I2C
  160. #define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* Main EEPROM */
  161. #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
  162. /* PMIC support */
  163. #define CONFIG_POWER_TPS65217
  164. #define CONFIG_POWER_TPS65910
  165. /* SPL */
  166. #ifndef CONFIG_NOR_BOOT
  167. /* Bootcount using the RTC block */
  168. #define CONFIG_BOOTCOUNT_LIMIT
  169. #define CONFIG_BOOTCOUNT_AM33XX
  170. #define CONFIG_SYS_BOOTCOUNT_BE
  171. /* USB gadget RNDIS */
  172. #define CONFIG_SPL_LDSCRIPT "arch/arm/mach-omap2/u-boot-spl.lds"
  173. #endif
  174. #ifdef CONFIG_NAND
  175. /* NAND: device related configs */
  176. #define CONFIG_SYS_NAND_5_ADDR_CYCLE
  177. #define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \
  178. CONFIG_SYS_NAND_PAGE_SIZE)
  179. #define CONFIG_SYS_NAND_PAGE_SIZE 2048
  180. #define CONFIG_SYS_NAND_OOBSIZE 64
  181. #define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024)
  182. /* NAND: driver related configs */
  183. #define CONFIG_NAND_OMAP_GPMC
  184. #define CONFIG_NAND_OMAP_GPMC_PREFETCH
  185. #define CONFIG_NAND_OMAP_ELM
  186. #define CONFIG_SYS_NAND_BAD_BLOCK_POS NAND_LARGE_BADBLOCK_POS
  187. #define CONFIG_SYS_NAND_ECCPOS { 2, 3, 4, 5, 6, 7, 8, 9, \
  188. 10, 11, 12, 13, 14, 15, 16, 17, \
  189. 18, 19, 20, 21, 22, 23, 24, 25, \
  190. 26, 27, 28, 29, 30, 31, 32, 33, \
  191. 34, 35, 36, 37, 38, 39, 40, 41, \
  192. 42, 43, 44, 45, 46, 47, 48, 49, \
  193. 50, 51, 52, 53, 54, 55, 56, 57, }
  194. #define CONFIG_SYS_NAND_ECCSIZE 512
  195. #define CONFIG_SYS_NAND_ECCBYTES 14
  196. #define CONFIG_SYS_NAND_ONFI_DETECTION
  197. #define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH8_CODE_HW
  198. #define MTDIDS_DEFAULT "nand0=nand.0"
  199. #define MTDPARTS_DEFAULT "mtdparts=nand.0:" \
  200. "128k(NAND.SPL)," \
  201. "128k(NAND.SPL.backup1)," \
  202. "128k(NAND.SPL.backup2)," \
  203. "128k(NAND.SPL.backup3)," \
  204. "256k(NAND.u-boot-spl-os)," \
  205. "1m(NAND.u-boot)," \
  206. "128k(NAND.u-boot-env)," \
  207. "128k(NAND.u-boot-env.backup1)," \
  208. "8m(NAND.kernel)," \
  209. "-(NAND.file-system)"
  210. #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x000c0000
  211. /* NAND: SPL related configs */
  212. #ifdef CONFIG_SPL_NAND_SUPPORT
  213. #define CONFIG_SPL_NAND_AM33XX_BCH
  214. #endif
  215. #ifdef CONFIG_SPL_OS_BOOT
  216. #define CONFIG_CMD_SPL_NAND_OFS 0x00080000 /* os parameters */
  217. #define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x00200000 /* kernel offset */
  218. #define CONFIG_CMD_SPL_WRITE_SIZE 0x2000
  219. #endif
  220. #endif /* !CONFIG_NAND */
  221. /*
  222. * For NOR boot, we must set this to the start of where NOR is mapped
  223. * in memory.
  224. */
  225. #ifdef CONFIG_NOR_BOOT
  226. #define CONFIG_SYS_TEXT_BASE 0x08000000
  227. #endif
  228. /*
  229. * USB configuration. We enable MUSB support, both for host and for
  230. * gadget. We set USB0 as peripheral and USB1 as host, based on the
  231. * board schematic and physical port wired to each. Then for host we
  232. * add mass storage support and for gadget we add both RNDIS ethernet
  233. * and DFU.
  234. */
  235. #define CONFIG_USB_MUSB_DSPS
  236. #define CONFIG_ARCH_MISC_INIT
  237. #define CONFIG_USB_MUSB_PIO_ONLY
  238. #define CONFIG_USB_MUSB_DISABLE_BULK_COMBINE_SPLIT
  239. #define CONFIG_AM335X_USB0
  240. #define CONFIG_AM335X_USB0_MODE MUSB_PERIPHERAL
  241. #define CONFIG_AM335X_USB1
  242. #define CONFIG_AM335X_USB1_MODE MUSB_HOST
  243. #ifndef CONFIG_SPL_USBETH_SUPPORT
  244. /* Fastboot */
  245. #define CONFIG_USB_FUNCTION_FASTBOOT
  246. #define CONFIG_CMD_FASTBOOT
  247. #define CONFIG_ANDROID_BOOT_IMAGE
  248. #define CONFIG_FASTBOOT_BUF_ADDR CONFIG_SYS_LOAD_ADDR
  249. #define CONFIG_FASTBOOT_BUF_SIZE 0x07000000
  250. #define CONFIG_FASTBOOT_FLASH_MMC_DEV 1
  251. #endif
  252. #ifdef CONFIG_USB_MUSB_GADGET
  253. #define CONFIG_USB_ETHER
  254. #define CONFIG_USB_ETH_RNDIS
  255. #define CONFIG_USBNET_HOST_ADDR "de:ad:be:af:00:00"
  256. #endif /* CONFIG_USB_MUSB_GADGET */
  257. /*
  258. * Disable MMC DM for SPL build and can be re-enabled after adding
  259. * DM support in SPL
  260. */
  261. #ifdef CONFIG_SPL_BUILD
  262. #undef CONFIG_DM_MMC
  263. #undef CONFIG_TIMER
  264. #undef CONFIG_DM_USB
  265. #undef CONFIG_DM_NAND
  266. #endif
  267. #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_USBETH_SUPPORT)
  268. /* disable host part of MUSB in SPL */
  269. /* disable EFI partitions and partition UUID support */
  270. #undef CONFIG_PARTITION_UUIDS
  271. #undef CONFIG_EFI_PARTITION
  272. #endif
  273. /* USB Device Firmware Update support */
  274. #ifndef CONFIG_SPL_BUILD
  275. #define DFUARGS \
  276. "dfu_alt_info_emmc=rawemmc raw 0 3751936\0" \
  277. DFU_ALT_INFO_MMC \
  278. DFU_ALT_INFO_RAM \
  279. DFU_ALT_INFO_NAND
  280. #endif
  281. /*
  282. * Default to using SPI for environment, etc.
  283. * 0x000000 - 0x020000 : SPL (128KiB)
  284. * 0x020000 - 0x0A0000 : U-Boot (512KiB)
  285. * 0x0A0000 - 0x0BFFFF : First copy of U-Boot Environment (128KiB)
  286. * 0x0C0000 - 0x0DFFFF : Second copy of U-Boot Environment (128KiB)
  287. * 0x0E0000 - 0x442000 : Linux Kernel
  288. * 0x442000 - 0x800000 : Userland
  289. */
  290. #if defined(CONFIG_SPI_BOOT)
  291. /* SPL related */
  292. #define CONFIG_SPL_SPI_LOAD
  293. #define CONFIG_SYS_SPI_U_BOOT_OFFS 0x20000
  294. #define CONFIG_ENV_IS_IN_SPI_FLASH
  295. #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
  296. #define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED
  297. #define CONFIG_ENV_SECT_SIZE (4 << 10) /* 4 KB sectors */
  298. #define CONFIG_ENV_OFFSET (768 << 10) /* 768 KiB in */
  299. #define CONFIG_ENV_OFFSET_REDUND (896 << 10) /* 896 KiB in */
  300. #define MTDIDS_DEFAULT "nor0=m25p80-flash.0"
  301. #define MTDPARTS_DEFAULT "mtdparts=m25p80-flash.0:128k(SPL)," \
  302. "512k(u-boot),128k(u-boot-env1)," \
  303. "128k(u-boot-env2),3464k(kernel)," \
  304. "-(rootfs)"
  305. #elif defined(CONFIG_EMMC_BOOT)
  306. #define CONFIG_ENV_IS_IN_MMC
  307. #define CONFIG_SYS_MMC_ENV_DEV 1
  308. #define CONFIG_SYS_MMC_ENV_PART 2
  309. #define CONFIG_ENV_OFFSET 0x0
  310. #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)
  311. #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
  312. #elif defined(CONFIG_NOR_BOOT)
  313. #define CONFIG_ENV_IS_IN_FLASH
  314. #define CONFIG_ENV_SECT_SIZE (128 << 10) /* 128 KiB */
  315. #define CONFIG_ENV_OFFSET (512 << 10) /* 512 KiB */
  316. #define CONFIG_ENV_OFFSET_REDUND (768 << 10) /* 768 KiB */
  317. #define MTDIDS_DEFAULT "nor0=physmap-flash.0"
  318. #define MTDPARTS_DEFAULT "mtdparts=physmap-flash.0:" \
  319. "512k(u-boot)," \
  320. "128k(u-boot-env1)," \
  321. "128k(u-boot-env2)," \
  322. "4m(kernel),-(rootfs)"
  323. #elif defined(CONFIG_ENV_IS_IN_NAND)
  324. #define CONFIG_ENV_OFFSET 0x001c0000
  325. #define CONFIG_ENV_OFFSET_REDUND 0x001e0000
  326. #define CONFIG_SYS_ENV_SECT_SIZE CONFIG_SYS_NAND_BLOCK_SIZE
  327. #elif !defined(CONFIG_ENV_IS_NOWHERE)
  328. /* Not NAND, SPI, NOR or eMMC env, so put ENV in a file on FAT */
  329. #define CONFIG_ENV_IS_IN_FAT
  330. #define FAT_ENV_INTERFACE "mmc"
  331. #define FAT_ENV_DEVICE_AND_PART "0:1"
  332. #define FAT_ENV_FILE "uboot.env"
  333. #endif
  334. /* SPI flash. */
  335. #define CONFIG_SF_DEFAULT_SPEED 24000000
  336. /* Network. */
  337. #define CONFIG_PHY_GIGE
  338. #define CONFIG_PHYLIB
  339. #define CONFIG_PHY_SMSC
  340. /* Enable Atheros phy driver */
  341. #define CONFIG_PHY_ATHEROS
  342. /*
  343. * NOR Size = 16 MiB
  344. * Number of Sectors/Blocks = 128
  345. * Sector Size = 128 KiB
  346. * Word length = 16 bits
  347. * Default layout:
  348. * 0x000000 - 0x07FFFF : U-Boot (512 KiB)
  349. * 0x080000 - 0x09FFFF : First copy of U-Boot Environment (128 KiB)
  350. * 0x0A0000 - 0x0BFFFF : Second copy of U-Boot Environment (128 KiB)
  351. * 0x0C0000 - 0x4BFFFF : Linux Kernel (4 MiB)
  352. * 0x4C0000 - 0xFFFFFF : Userland (11 MiB + 256 KiB)
  353. */
  354. #if defined(CONFIG_NOR)
  355. #undef CONFIG_SYS_NO_FLASH
  356. #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE
  357. #define CONFIG_SYS_FLASH_PROTECTION
  358. #define CONFIG_SYS_FLASH_CFI
  359. #define CONFIG_FLASH_CFI_DRIVER
  360. #define CONFIG_FLASH_CFI_MTD
  361. #define CONFIG_SYS_MAX_FLASH_SECT 128
  362. #define CONFIG_SYS_MAX_FLASH_BANKS 1
  363. #define CONFIG_SYS_FLASH_BASE (0x08000000)
  364. #define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT
  365. #define CONFIG_SYS_FLASH_SIZE 0x01000000
  366. #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_FLASH_BASE
  367. #endif /* NOR support */
  368. #ifdef CONFIG_DRIVER_TI_CPSW
  369. #define CONFIG_CLOCK_SYNTHESIZER
  370. #define CLK_SYNTHESIZER_I2C_ADDR 0x65
  371. #endif
  372. #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_TI_SECURE_DEVICE)
  373. #undef CONFIG_EFI_PARTITION
  374. #endif /* CONFIG_SPL_BUILD && CONFIG_TI_SECURE_DEVICE */
  375. #endif /* ! __CONFIG_AM335X_EVM_H */