am335x_evm.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  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. #define MACH_TYPE_TIAM335EVM 3589 /* Until the next sync */
  19. #define CONFIG_MACH_TYPE MACH_TYPE_TIAM335EVM
  20. /* Clock Defines */
  21. #define V_OSCK 24000000 /* Clock output from T2 */
  22. #define V_SCLK (V_OSCK)
  23. /* Custom script for NOR */
  24. #define CONFIG_SYS_LDSCRIPT "board/ti/am335x/u-boot.lds"
  25. /* Always 128 KiB env size */
  26. #define CONFIG_ENV_SIZE (128 << 10)
  27. #ifdef CONFIG_NAND
  28. #define NANDARGS \
  29. "mtdids=" MTDIDS_DEFAULT "\0" \
  30. "mtdparts=" MTDPARTS_DEFAULT "\0" \
  31. "nandargs=setenv bootargs console=${console} " \
  32. "${optargs} " \
  33. "root=${nandroot} " \
  34. "rootfstype=${nandrootfstype}\0" \
  35. "dfu_alt_info_nand=" DFU_ALT_INFO_NAND "\0" \
  36. "nandroot=ubi0:rootfs rw ubi.mtd=7,2048\0" \
  37. "nandrootfstype=ubifs rootwait=1\0" \
  38. "nandsrcaddr=0x280000\0" \
  39. "nandboot=echo Booting from nand ...; " \
  40. "run nandargs; " \
  41. "nand read ${loadaddr} ${nandsrcaddr} ${nandimgsize}; " \
  42. "bootm ${loadaddr}\0" \
  43. "nandimgsize=0x500000\0"
  44. #else
  45. #define NANDARGS ""
  46. #endif
  47. #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
  48. #ifndef CONFIG_SPL_BUILD
  49. #define CONFIG_EXTRA_ENV_SETTINGS \
  50. "loadaddr=0x80200000\0" \
  51. "fdtaddr=0x80F80000\0" \
  52. "fdt_high=0xffffffff\0" \
  53. "boot_fdt=try\0" \
  54. "rdaddr=0x81000000\0" \
  55. "bootdir=/boot\0" \
  56. "bootfile=uImage\0" \
  57. "fdtfile=undefined\0" \
  58. "console=ttyO0,115200n8\0" \
  59. "optargs=\0" \
  60. "dfu_alt_info_mmc=" DFU_ALT_INFO_MMC "\0" \
  61. "dfu_alt_info_emmc=rawemmc mmc 0 3751936\0" \
  62. "mmcdev=0\0" \
  63. "mmcroot=/dev/mmcblk0p2 ro\0" \
  64. "mmcrootfstype=ext4 rootwait\0" \
  65. "bootpart=0:2\0" \
  66. "rootpath=/export/rootfs\0" \
  67. "nfsopts=nolock\0" \
  68. "static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}" \
  69. "::off\0" \
  70. "ramroot=/dev/ram0 rw ramdisk_size=65536 initrd=${rdaddr},64M\0" \
  71. "ramrootfstype=ext2\0" \
  72. "mmcargs=setenv bootargs console=${console} " \
  73. "${optargs} " \
  74. "root=${mmcroot} " \
  75. "rootfstype=${mmcrootfstype}\0" \
  76. "spiroot=/dev/mtdblock4 rw\0" \
  77. "spirootfstype=jffs2\0" \
  78. "spisrcaddr=0xe0000\0" \
  79. "spiimgsize=0x362000\0" \
  80. "spibusno=0\0" \
  81. "spiargs=setenv bootargs console=${console} " \
  82. "${optargs} " \
  83. "root=${spiroot} " \
  84. "rootfstype=${spirootfstype}\0" \
  85. "netargs=setenv bootargs console=${console} " \
  86. "${optargs} " \
  87. "root=/dev/nfs " \
  88. "nfsroot=${serverip}:${rootpath},${nfsopts} rw " \
  89. "ip=dhcp\0" \
  90. "bootenv=uEnv.txt\0" \
  91. "loadbootenv=load mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
  92. "importbootenv=echo Importing environment from mmc ...; " \
  93. "env import -t $loadaddr $filesize\0" \
  94. "ramargs=setenv bootargs console=${console} " \
  95. "${optargs} " \
  96. "root=${ramroot} " \
  97. "rootfstype=${ramrootfstype}\0" \
  98. "loadramdisk=load mmc ${mmcdev} ${rdaddr} ramdisk.gz\0" \
  99. "loaduimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
  100. "loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
  101. "mmcloados=run mmcargs; " \
  102. "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
  103. "if run loadfdt; then " \
  104. "bootm ${loadaddr} - ${fdtaddr}; " \
  105. "else " \
  106. "if test ${boot_fdt} = try; then " \
  107. "bootm; " \
  108. "else " \
  109. "echo WARN: Cannot load the DT; " \
  110. "fi; " \
  111. "fi; " \
  112. "else " \
  113. "bootm; " \
  114. "fi;\0" \
  115. "mmcboot=mmc dev ${mmcdev}; " \
  116. "if mmc rescan; then " \
  117. "echo SD/MMC found on device ${mmcdev};" \
  118. "if run loadbootenv; then " \
  119. "echo Loaded environment from ${bootenv};" \
  120. "run importbootenv;" \
  121. "fi;" \
  122. "if test -n $uenvcmd; then " \
  123. "echo Running uenvcmd ...;" \
  124. "run uenvcmd;" \
  125. "fi;" \
  126. "if run loaduimage; then " \
  127. "run mmcloados;" \
  128. "fi;" \
  129. "fi;\0" \
  130. "spiboot=echo Booting from spi ...; " \
  131. "run spiargs; " \
  132. "sf probe ${spibusno}:0; " \
  133. "sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; " \
  134. "bootm ${loadaddr}\0" \
  135. "netboot=echo Booting from network ...; " \
  136. "setenv autoload no; " \
  137. "dhcp; " \
  138. "tftp ${loadaddr} ${bootfile}; " \
  139. "tftp ${fdtaddr} ${fdtfile}; " \
  140. "run netargs; " \
  141. "bootm ${loadaddr} - ${fdtaddr}\0" \
  142. "ramboot=echo Booting from ramdisk ...; " \
  143. "run ramargs; " \
  144. "bootm ${loadaddr} ${rdaddr} ${fdtaddr}\0" \
  145. "findfdt="\
  146. "if test $board_name = A335BONE; then " \
  147. "setenv fdtfile am335x-bone.dtb; fi; " \
  148. "if test $board_name = A335BNLT; then " \
  149. "setenv fdtfile am335x-boneblack.dtb; fi; " \
  150. "if test $board_name = A33515BB; then " \
  151. "setenv fdtfile am335x-evm.dtb; fi; " \
  152. "if test $board_name = A335X_SK; then " \
  153. "setenv fdtfile am335x-evmsk.dtb; fi; " \
  154. "if test $fdtfile = undefined; then " \
  155. "echo WARNING: Could not determine device tree to use; fi; \0" \
  156. NANDARGS
  157. #endif
  158. #define CONFIG_BOOTCOMMAND \
  159. "run findfdt; " \
  160. "run mmcboot;" \
  161. "setenv mmcdev 1; " \
  162. "setenv bootpart 1:2; " \
  163. "run mmcboot;" \
  164. "run nandboot;"
  165. /* NS16550 Configuration */
  166. #define CONFIG_SYS_NS16550_COM1 0x44e09000 /* Base EVM has UART0 */
  167. #define CONFIG_SYS_NS16550_COM2 0x48022000 /* UART1 */
  168. #define CONFIG_SYS_NS16550_COM3 0x48024000 /* UART2 */
  169. #define CONFIG_SYS_NS16550_COM4 0x481a6000 /* UART3 */
  170. #define CONFIG_SYS_NS16550_COM5 0x481a8000 /* UART4 */
  171. #define CONFIG_SYS_NS16550_COM6 0x481aa000 /* UART5 */
  172. #define CONFIG_BAUDRATE 115200
  173. /* I2C Configuration */
  174. #define CONFIG_CMD_EEPROM
  175. #define CONFIG_ENV_EEPROM_IS_ON_I2C
  176. #define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* Main EEPROM */
  177. #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
  178. #define CONFIG_SYS_I2C_MULTI_EEPROMS
  179. /* SPL */
  180. #ifndef CONFIG_NOR_BOOT
  181. #define CONFIG_SPL_YMODEM_SUPPORT
  182. /* CPSW support */
  183. #define CONFIG_SPL_ETH_SUPPORT
  184. /* USB gadget RNDIS */
  185. #define CONFIG_SPL_MUSB_NEW_SUPPORT
  186. /* General network SPL, both CPSW and USB gadget RNDIS */
  187. #define CONFIG_SPL_NET_SUPPORT
  188. #define CONFIG_SPL_ENV_SUPPORT
  189. #define CONFIG_SPL_NET_VCI_STRING "AM335x U-Boot SPL"
  190. /* SPI flash. */
  191. #define CONFIG_SPL_SPI_SUPPORT
  192. #define CONFIG_SPL_SPI_FLASH_SUPPORT
  193. #define CONFIG_SPL_SPI_LOAD
  194. #define CONFIG_SPL_SPI_BUS 0
  195. #define CONFIG_SPL_SPI_CS 0
  196. #define CONFIG_SYS_SPI_U_BOOT_OFFS 0x20000
  197. #define CONFIG_SPL_LDSCRIPT "$(CPUDIR)/am33xx/u-boot-spl.lds"
  198. #ifdef CONFIG_NAND
  199. #define CONFIG_SYS_NAND_5_ADDR_CYCLE
  200. #define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \
  201. CONFIG_SYS_NAND_PAGE_SIZE)
  202. #define CONFIG_SYS_NAND_PAGE_SIZE 2048
  203. #define CONFIG_SYS_NAND_OOBSIZE 64
  204. #define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024)
  205. #define CONFIG_SYS_NAND_BAD_BLOCK_POS NAND_LARGE_BADBLOCK_POS
  206. #define CONFIG_SYS_NAND_ECCPOS { 2, 3, 4, 5, 6, 7, 8, 9, \
  207. 10, 11, 12, 13, 14, 15, 16, 17, \
  208. 18, 19, 20, 21, 22, 23, 24, 25, \
  209. 26, 27, 28, 29, 30, 31, 32, 33, \
  210. 34, 35, 36, 37, 38, 39, 40, 41, \
  211. 42, 43, 44, 45, 46, 47, 48, 49, \
  212. 50, 51, 52, 53, 54, 55, 56, 57, }
  213. #define CONFIG_SYS_NAND_ECCSIZE 512
  214. #define CONFIG_SYS_NAND_ECCBYTES 14
  215. #define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE
  216. #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x80000
  217. #endif
  218. #endif
  219. /*
  220. * For NOR boot, we must set this to the start of where NOR is mapped
  221. * in memory.
  222. */
  223. #ifdef CONFIG_NOR_BOOT
  224. #define CONFIG_SYS_TEXT_BASE 0x08000000
  225. #endif
  226. /*
  227. * USB configuration. We enable MUSB support, both for host and for
  228. * gadget. We set USB0 as peripheral and USB1 as host, based on the
  229. * board schematic and physical port wired to each. Then for host we
  230. * add mass storage support and for gadget we add both RNDIS ethernet
  231. * and DFU.
  232. */
  233. #define CONFIG_USB_MUSB_DSPS
  234. #define CONFIG_ARCH_MISC_INIT
  235. #define CONFIG_MUSB_GADGET
  236. #define CONFIG_MUSB_PIO_ONLY
  237. #define CONFIG_MUSB_DISABLE_BULK_COMBINE_SPLIT
  238. #define CONFIG_USB_GADGET
  239. #define CONFIG_USBDOWNLOAD_GADGET
  240. #define CONFIG_USB_GADGET_DUALSPEED
  241. #define CONFIG_USB_GADGET_VBUS_DRAW 2
  242. #define CONFIG_MUSB_HOST
  243. #define CONFIG_AM335X_USB0
  244. #define CONFIG_AM335X_USB0_MODE MUSB_PERIPHERAL
  245. #define CONFIG_AM335X_USB1
  246. #define CONFIG_AM335X_USB1_MODE MUSB_HOST
  247. #ifdef CONFIG_MUSB_HOST
  248. #define CONFIG_CMD_USB
  249. #define CONFIG_USB_STORAGE
  250. #endif
  251. #ifdef CONFIG_MUSB_GADGET
  252. #define CONFIG_USB_ETHER
  253. #define CONFIG_USB_ETH_RNDIS
  254. #define CONFIG_USBNET_HOST_ADDR "de:ad:be:af:00:00"
  255. /* USB TI's IDs */
  256. #define CONFIG_G_DNL_VENDOR_NUM 0x0403
  257. #define CONFIG_G_DNL_PRODUCT_NUM 0xBD00
  258. #define CONFIG_G_DNL_MANUFACTURER "Texas Instruments"
  259. #endif /* CONFIG_MUSB_GADGET */
  260. #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_USBETH_SUPPORT)
  261. /* disable host part of MUSB in SPL */
  262. #undef CONFIG_MUSB_HOST
  263. /*
  264. * Disable CPSW SPL support so we fit within the 101KiB limit.
  265. */
  266. #undef CONFIG_SPL_ETH_SUPPORT
  267. #endif
  268. /* USB Device Firmware Update support */
  269. #define CONFIG_DFU_FUNCTION
  270. #define CONFIG_DFU_MMC
  271. #define CONFIG_CMD_DFU
  272. #define DFU_ALT_INFO_MMC \
  273. "boot part 0 1;" \
  274. "rootfs part 0 2;" \
  275. "MLO fat 0 1;" \
  276. "MLO.raw mmc 100 100;" \
  277. "u-boot.img.raw mmc 300 400;" \
  278. "spl-os-args.raw mmc 80 80;" \
  279. "spl-os-image.raw mmc 900 2000;" \
  280. "spl-os-args fat 0 1;" \
  281. "spl-os-image fat 0 1;" \
  282. "u-boot.img fat 0 1;" \
  283. "uEnv.txt fat 0 1"
  284. #ifdef CONFIG_NAND
  285. #define CONFIG_DFU_NAND
  286. #define DFU_ALT_INFO_NAND \
  287. "SPL part 0 1;" \
  288. "SPL.backup1 part 0 2;" \
  289. "SPL.backup2 part 0 3;" \
  290. "SPL.backup3 part 0 4;" \
  291. "u-boot part 0 5;" \
  292. "u-boot-spl-os part 0 6;" \
  293. "kernel part 0 8;" \
  294. "rootfs part 0 9"
  295. #endif
  296. /*
  297. * Default to using SPI for environment, etc.
  298. * 0x000000 - 0x020000 : SPL (128KiB)
  299. * 0x020000 - 0x0A0000 : U-Boot (512KiB)
  300. * 0x0A0000 - 0x0BFFFF : First copy of U-Boot Environment (128KiB)
  301. * 0x0C0000 - 0x0DFFFF : Second copy of U-Boot Environment (128KiB)
  302. * 0x0E0000 - 0x442000 : Linux Kernel
  303. * 0x442000 - 0x800000 : Userland
  304. */
  305. #if defined(CONFIG_SPI_BOOT)
  306. #define CONFIG_ENV_IS_IN_SPI_FLASH
  307. #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
  308. #define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED
  309. #define CONFIG_ENV_SECT_SIZE (4 << 10) /* 4 KB sectors */
  310. #define CONFIG_ENV_OFFSET (768 << 10) /* 768 KiB in */
  311. #define CONFIG_ENV_OFFSET_REDUND (896 << 10) /* 896 KiB in */
  312. #define MTDIDS_DEFAULT "nor0=m25p80-flash.0"
  313. #define MTDPARTS_DEFAULT "mtdparts=m25p80-flash.0:128k(SPL)," \
  314. "512k(u-boot),128k(u-boot-env1)," \
  315. "128k(u-boot-env2),3464k(kernel)," \
  316. "-(rootfs)"
  317. #elif defined(CONFIG_EMMC_BOOT)
  318. #undef CONFIG_ENV_IS_NOWHERE
  319. #define CONFIG_ENV_IS_IN_MMC
  320. #define CONFIG_SYS_MMC_ENV_DEV 1
  321. #define CONFIG_SYS_MMC_ENV_PART 2
  322. #endif
  323. /* SPI flash. */
  324. #define CONFIG_CMD_SF
  325. #define CONFIG_SPI_FLASH
  326. #define CONFIG_SPI_FLASH_WINBOND
  327. #define CONFIG_SF_DEFAULT_SPEED 24000000
  328. /* Network. */
  329. #define CONFIG_PHY_GIGE
  330. #define CONFIG_PHYLIB
  331. #define CONFIG_PHY_ADDR 0
  332. #define CONFIG_PHY_SMSC
  333. /* NAND support */
  334. #ifdef CONFIG_NAND
  335. #define CONFIG_CMD_NAND
  336. #define GPMC_NAND_ECC_LP_x16_LAYOUT 1
  337. #if !defined(CONFIG_SPI_BOOT) && !defined(CONFIG_NOR_BOOT)
  338. #define MTDIDS_DEFAULT "nand0=omap2-nand.0"
  339. #define MTDPARTS_DEFAULT "mtdparts=omap2-nand.0:128k(SPL)," \
  340. "128k(SPL.backup1)," \
  341. "128k(SPL.backup2)," \
  342. "128k(SPL.backup3),1792k(u-boot)," \
  343. "128k(u-boot-spl-os)," \
  344. "128k(u-boot-env),5m(kernel),-(rootfs)"
  345. #define CONFIG_ENV_IS_IN_NAND
  346. #define CONFIG_ENV_OFFSET 0x260000 /* environment starts here */
  347. #define CONFIG_SYS_ENV_SECT_SIZE (128 << 10) /* 128 KiB */
  348. #endif
  349. #endif
  350. /*
  351. * NOR Size = 16 MiB
  352. * Number of Sectors/Blocks = 128
  353. * Sector Size = 128 KiB
  354. * Word length = 16 bits
  355. * Default layout:
  356. * 0x000000 - 0x07FFFF : U-Boot (512 KiB)
  357. * 0x080000 - 0x09FFFF : First copy of U-Boot Environment (128 KiB)
  358. * 0x0A0000 - 0x0BFFFF : Second copy of U-Boot Environment (128 KiB)
  359. * 0x0C0000 - 0x4BFFFF : Linux Kernel (4 MiB)
  360. * 0x4C0000 - 0xFFFFFF : Userland (11 MiB + 256 KiB)
  361. */
  362. #if defined(CONFIG_NOR)
  363. #undef CONFIG_SYS_NO_FLASH
  364. #define CONFIG_CMD_FLASH
  365. #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE
  366. #define CONFIG_SYS_FLASH_PROTECTION
  367. #define CONFIG_SYS_FLASH_CFI
  368. #define CONFIG_FLASH_CFI_DRIVER
  369. #define CONFIG_FLASH_CFI_MTD
  370. #define CONFIG_SYS_MAX_FLASH_SECT 128
  371. #define CONFIG_SYS_MAX_FLASH_BANKS 1
  372. #define CONFIG_SYS_FLASH_BASE (0x08000000)
  373. #define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT
  374. #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_FLASH_BASE
  375. #ifdef CONFIG_NOR_BOOT
  376. #define CONFIG_ENV_IS_IN_FLASH
  377. #define CONFIG_ENV_SECT_SIZE (128 << 10) /* 128 KiB */
  378. #define CONFIG_ENV_OFFSET (512 << 10) /* 512 KiB */
  379. #define CONFIG_ENV_OFFSET_REDUND (768 << 10) /* 768 KiB */
  380. #define MTDIDS_DEFAULT "nor0=physmap-flash.0"
  381. #define MTDPARTS_DEFAULT "mtdparts=physmap-flash.0:" \
  382. "512k(u-boot)," \
  383. "128k(u-boot-env1)," \
  384. "128k(u-boot-env2)," \
  385. "4m(kernel),-(rootfs)"
  386. #endif
  387. #endif /* NOR support */
  388. #endif /* ! __CONFIG_AM335X_EVM_H */