am335x_shc.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2016
  4. * Heiko Schocher, DENX Software Engineering, hs@denx.de.
  5. *
  6. * Based on:
  7. * am335x_evm.h
  8. *
  9. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
  10. */
  11. #ifndef __CONFIG_AM335X_SHC_H
  12. #define __CONFIG_AM335X_SHC_H
  13. #include <configs/ti_am335x_common.h>
  14. /* settings we don;t want on this board */
  15. #undef CONFIG_CMD_SPI
  16. #define CONFIG_CMD_CACHE
  17. #ifndef CONFIG_SPL_BUILD
  18. # define CONFIG_TIMESTAMP
  19. #endif
  20. #define CONFIG_SYS_BOOTM_LEN (16 << 20)
  21. /* Clock Defines */
  22. #define V_OSCK 24000000 /* Clock output from T2 */
  23. #define V_SCLK (V_OSCK)
  24. /*
  25. * in case of SD Card or Network boot we want to have a possibility to
  26. * debrick the shc, therefore do not read environment from eMMC
  27. */
  28. #if defined(CONFIG_SHC_SDBOOT) || defined(CONFIG_SHC_NETBOOT)
  29. #define CONFIG_SYS_MMC_ENV_DEV 0
  30. #else
  31. #define CONFIG_SYS_MMC_ENV_DEV 1
  32. #endif
  33. /*
  34. * Info when using boot partitions: As environment resides within first
  35. * 128 kB, MLO must start at 128 kB == 0x20000
  36. * ENV at MMC Boot0 Partition - 0/Undefined=user, 1=boot0, 2=boot1,
  37. * 4..7=general0..3
  38. */
  39. #define CONFIG_HSMMC2_8BIT
  40. #ifndef CONFIG_SHC_ICT
  41. /*
  42. * In builds other than ICT, reset to retry after timeout
  43. * Define a timeout after which a stopped bootloader continues autoboot
  44. * (only works with CONFIG_RESET_TO_RETRY)
  45. */
  46. # define CONFIG_BOOT_RETRY_TIME 30
  47. # define CONFIG_RESET_TO_RETRY
  48. #endif
  49. #ifndef CONFIG_SPL_BUILD
  50. #define CONFIG_EXTRA_ENV_SETTINGS \
  51. "loadaddr=0x80200000\0" \
  52. "kloadaddr=0x84000000\0" \
  53. "fdtaddr=0x85000000\0" \
  54. "fdt_high=0xffffffff\0" \
  55. "rdaddr=0x81000000\0" \
  56. "bootfile=uImage\0" \
  57. "fdtfile=am335x-shc.dtb\0" \
  58. "verify=no\0" \
  59. "serverip=10.55.152.184\0" \
  60. "rootpath=/srv/nfs/shc-rootfs\0" \
  61. "console=ttyO0,115200n8\0" \
  62. "optargs=quiet\0" \
  63. "mmcdev=1\0" \
  64. "harakiri=0\0" \
  65. "mmcpart=2\0" \
  66. "active_root=root1\0" \
  67. "inactive_root=root2\0" \
  68. "mmcrootfstype=ext4 rootwait\0" \
  69. "nfsopts=nolock\0" \
  70. "static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}" \
  71. "::off\0" \
  72. "ip_method=none\0" \
  73. "bootargs_defaults=setenv bootargs " \
  74. "console=${console} " \
  75. "${optargs}\0" \
  76. "mmcargs=run bootargs_defaults;" \
  77. "setenv bootargs ${bootargs} " \
  78. "root=${mmcroot} " \
  79. "rootfstype=${mmcrootfstype} ip=${ip_method}\0" \
  80. "netargs=setenv bootargs console=${console} " \
  81. "${optargs} " \
  82. "root=/dev/nfs " \
  83. "nfsroot=${serverip}:${rootpath},${nfsopts} rw " \
  84. "ip=dhcp\0" \
  85. "bootenv=uEnv.txt\0" \
  86. "loadbootenv=if fatload mmc ${mmcdev} ${loadaddr} ${bootenv}; then " \
  87. "echo Loaded environment from ${bootenv}; " \
  88. "run importbootenv; " \
  89. "fi;\0" \
  90. "importbootenv=echo Importing environment variables from uEnv.txt ...; " \
  91. "env import -t $loadaddr $filesize\0" \
  92. "loaduimagefat=fatload mmc ${mmcdev} ${kloadaddr} ${bootfile}\0" \
  93. "loaduimage=ext2load mmc ${mmcdev}:${mmcpart} ${kloadaddr} /boot/${bootfile}\0" \
  94. "loadfdt=ext2load mmc ${mmcdev}:${mmcpart} ${fdtaddr} /boot/${fdtfile}\0" \
  95. "netloaduimage=tftp ${loadaddr} ${bootfile}\0" \
  96. "netloadfdt=tftp ${fdtaddr} ${fdtfile}\0" \
  97. "mmcboot=echo Booting Linux from ${mmcdevice} ...; " \
  98. "run mmcargs; " \
  99. "if run loadfdt; then " \
  100. "echo device tree detected; " \
  101. "bootm ${kloadaddr} - ${fdtaddr}; " \
  102. "else " \
  103. "bootm ${kloadaddr}; " \
  104. "fi; \0" \
  105. "netboot=echo Booting from network ...; " \
  106. "setenv autoload no; " \
  107. "dhcp; " \
  108. "run netloaduimage; " \
  109. "run netargs; " \
  110. "echo NFS path: ${serverip}:${rootpath};" \
  111. "if run netloadfdt; then " \
  112. "echo device tree detected; " \
  113. "bootm ${loadaddr} - ${fdtaddr}; " \
  114. "else " \
  115. "bootm ${loadaddr}; " \
  116. "fi; \0" \
  117. "emmc_erase=if test ${harakiri} = 1 ; then echo erase emmc ...; setenv mmcdev 1; mmc erase 0 200; reset; fi; \0" \
  118. "mmcpart_gp=mmcpart gp 1 40; \0" \
  119. "mmcpart_enhance=mmcpart enhance 0 64; \0" \
  120. "mmcpart_rel_write=mmcpart rel_write 1f; \0" \
  121. "mmcpart_commit=mmcpart commit 1; \0" \
  122. "mmc_hw_part=run mmcpart_gp; run mmcpart_enhance; run mmcpart_rel_write; run mmcpart_commit; \0" \
  123. "led_success=gpio set 22; \0" \
  124. "fusecmd=mmc dev 1; if mmcpart iscommitted; then echo HW Partitioning already committed; mmcpart list; else run mmc_hw_part; fi; run led_success; \0" \
  125. "uenv_exec=if test -n $uenvcmd; then " \
  126. "echo Running uenvcmd ...; " \
  127. "run uenvcmd; " \
  128. "fi;\0" \
  129. "sd_setup=echo SD/MMC-Card detected on device 0; " \
  130. "setenv mmcdevice SD; " \
  131. "setenv mmcdev 0; " \
  132. "setenv mmcpart 2; " \
  133. "setenv mmcroot /dev/mmcblk${mmcdev}p${mmcpart};\0" \
  134. "emmc_setup=echo eMMC detected on device 1; " \
  135. "setenv mmcdevice eMMC; " \
  136. "setenv mmcdev 1; " \
  137. "run emmc_erase; " \
  138. "if test ${active_root} = root2; then " \
  139. "echo Active root is partition 6 (root2); " \
  140. "setenv mmcpart 6; " \
  141. "else " \
  142. "echo Active root is partition 5 (root1); " \
  143. "setenv mmcpart 5; " \
  144. "fi; " \
  145. "setenv mmcroot /dev/mmcblk${mmcdev}p${mmcpart};\0"
  146. #endif /* #ifndef CONFIG_SPL_BUILD */
  147. #if defined CONFIG_SHC_NETBOOT
  148. /* Network Boot */
  149. # define CONFIG_BOOTCOMMAND \
  150. "run fusecmd; " \
  151. "if run netboot; then " \
  152. "echo Booting from network; " \
  153. "else " \
  154. "echo ERROR: Cannot boot from network!; " \
  155. "panic; " \
  156. "fi; "
  157. #elif defined CONFIG_SHC_SDBOOT /* !defined CONFIG_SHC_NETBOOT */
  158. /* SD-Card Boot */
  159. # define CONFIG_BOOTCOMMAND \
  160. "if mmc dev 0; mmc rescan; then " \
  161. "run sd_setup; " \
  162. "else " \
  163. "echo ERROR: SD/MMC-Card not detected!; " \
  164. "panic; " \
  165. "fi; " \
  166. "if run loaduimage; then " \
  167. "echo Bootable SD/MMC-Card inserted, booting from it!; " \
  168. "run mmcboot; " \
  169. "else " \
  170. "echo ERROR: Unable to load uImage from SD/MMC-Card!; " \
  171. "panic; " \
  172. "fi; "
  173. #elif defined CONFIG_SHC_ICT
  174. /* ICT adapter boots only u-boot and does HW partitioning */
  175. # define CONFIG_BOOTCOMMAND \
  176. "if mmc dev 0; mmc rescan; then " \
  177. "run sd_setup; " \
  178. "else " \
  179. "echo ERROR: SD/MMC-Card not detected!; " \
  180. "panic; " \
  181. "fi; " \
  182. "run fusecmd; "
  183. #else /* !defined CONFIG_SHC_NETBOOT, !defined CONFIG_SHC_SDBOOT */
  184. /* Regular Boot from internal eMMC */
  185. # define CONFIG_BOOTCOMMAND \
  186. "if mmc dev 1; mmc rescan; then " \
  187. "run emmc_setup; " \
  188. "else " \
  189. "echo ERROR: eMMC device not detected!; " \
  190. "panic; " \
  191. "fi; " \
  192. "if run loaduimage; then " \
  193. "run mmcboot; " \
  194. "else " \
  195. "echo ERROR Unable to load uImage from eMMC!; " \
  196. "echo Performing Rollback!; " \
  197. "setenv _active_ ${active_root}; " \
  198. "setenv _inactive_ ${inactive_root}; " \
  199. "setenv active_root ${_inactive_}; " \
  200. "setenv inactive_root ${_active_}; " \
  201. "saveenv; " \
  202. "reset; " \
  203. "fi; "
  204. #endif /* Regular Boot */
  205. /* NS16550 Configuration */
  206. #define CONFIG_SYS_NS16550_COM1 0x44e09000 /* UART0 */
  207. #define CONFIG_SYS_NS16550_COM2 0x48022000 /* UART1 */
  208. #define CONFIG_SYS_NS16550_COM3 0x48024000 /* UART2 */
  209. #define CONFIG_SYS_NS16550_COM4 0x481a6000 /* UART3 */
  210. #define CONFIG_SYS_NS16550_COM5 0x481a8000 /* UART4 */
  211. #define CONFIG_SYS_NS16550_COM6 0x481aa000 /* UART5 */
  212. /* PMIC support */
  213. #define CONFIG_POWER_TPS65217
  214. /* SPL */
  215. /*
  216. * Disable MMC DM for SPL build and can be re-enabled after adding
  217. * DM support in SPL
  218. */
  219. #ifdef CONFIG_SPL_BUILD
  220. #undef CONFIG_DM_MMC
  221. #undef CONFIG_TIMER
  222. #endif
  223. #define CONFIG_BOOTP_DEFAULT
  224. #define CONFIG_BOOTP_DNS2
  225. #define CONFIG_BOOTP_SEND_HOSTNAME
  226. #define CONFIG_NET_RETRY_COUNT 10
  227. #define CONFIG_PHY_SMSC
  228. /* I2C configuration */
  229. #define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* Main EEPROM */
  230. #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
  231. #define CONFIG_SYS_I2C_SPEED 400000
  232. #define CONFIG_SYS_I2C_SLAVE 1
  233. #endif /* ! __CONFIG_AM335X_SHC_H */