am335x_shc.h 7.3 KB

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