am335x_shc.h 6.8 KB

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