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