xref: /openbmc/u-boot/include/configs/am335x_shc.h (revision 2290fe06)
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_SPL_AM33XX_ENABLE_RTC32K_OSC
20 #undef CONFIG_CMD_EXT4
21 #undef CONFIG_CMD_EXT4_WRITE
22 #undef CONFIG_CMD_MMC_SPI
23 #undef CONFIG_CMD_SPI
24 #undef CONFIG_CMD_PXE
25 
26 #define CONFIG_CMD_CACHE
27 
28 #ifndef CONFIG_SPL_BUILD
29 # define CONFIG_TIMESTAMP
30 # define CONFIG_LZO
31 #endif
32 
33 #define CONFIG_SYS_BOOTM_LEN		(16 << 20)
34 
35 #define MACH_TYPE_BOSCH_SHC_B		9001
36 #define MACH_TYPE_BOSCH_SHC_B2		9002
37 #define MACH_TYPE_BOSCH_SHC_C		9003
38 #define MACH_TYPE_BOSCH_SHC_C2		9004
39 #define MACH_TYPE_BOSCH_SHC_C3		9005
40 #define MACH_TYPE_BOSCH_SHC		9006
41 #ifdef CONFIG_B_SAMPLE
42 # define CONFIG_MACH_TYPE		MACH_TYPE_BOSCH_SHC_B
43 #elif defined CONFIG_B2_SAMPLE
44 # define CONFIG_MACH_TYPE		MACH_TYPE_BOSCH_SHC_B2
45 #elif defined CONFIG_C_SAMPLE
46 # define CONFIG_MACH_TYPE		MACH_TYPE_BOSCH_SHC_C
47 #elif defined CONFIG_C2_SAMPLE
48 # define CONFIG_MACH_TYPE		MACH_TYPE_BOSCH_SHC_C2
49 #elif defined CONFIG_C3_SAMPLE
50 # define CONFIG_MACH_TYPE		MACH_TYPE_BOSCH_SHC_C3
51 #elif defined CONFIG_SERIES
52 # define CONFIG_MACH_TYPE		MACH_TYPE_BOSCH_SHC
53 #endif /* #ifdef CONFIG_B_SAMPLE */
54 
55 #define CONFIG_BOARD_LATE_INIT
56 
57 /* Clock Defines */
58 #define V_OSCK				24000000  /* Clock output from T2 */
59 #define V_SCLK				(V_OSCK)
60 
61 #define CONFIG_VERSION_VARIABLE
62 
63 #define CONFIG_ENV_IS_IN_MMC		1
64 
65 /*
66  * in case of SD Card or Network boot we want to have a possibility to
67  * debrick the shc, therefore do not read environment from eMMC
68  */
69 #if defined(CONFIG_SHC_SDBOOT) || defined(CONFIG_SHC_NETBOOT)
70 #define CONFIG_SYS_MMC_ENV_DEV		0
71 #else
72 #define CONFIG_SYS_MMC_ENV_DEV		1
73 #endif
74 
75 /*
76  * Info when using boot partitions: As environment resides within first
77  * 128 kB, MLO must start at 128 kB == 0x20000
78  * ENV at MMC Boot0 Partition - 0/Undefined=user, 1=boot0, 2=boot1,
79  * 4..7=general0..3
80  */
81 #define CONFIG_ENV_SIZE				0x1000 /* 4 KB */
82 #define CONFIG_ENV_OFFSET			0x7000 /* 28 kB */
83 
84 #define CONFIG_HSMMC2_8BIT
85 
86 #define CONFIG_ENV_OFFSET_REDUND    0x9000 /* 36 kB */
87 #define CONFIG_ENV_SIZE_REDUND      CONFIG_ENV_SIZE
88 
89 /* Enhance our eMMC support / experience. */
90 #define CONFIG_CMD_GPT
91 #define CONFIG_EFI_PARTITION
92 #ifdef CONFIG_SPL_BUILD
93 #undef CONFIG_ISO_PARTITION
94 #endif
95 #ifndef CONFIG_SHC_ICT
96 /*
97  * In builds other than ICT, reset to retry after timeout
98  * Define a timeout after which a stopped bootloader continues autoboot
99  * (only works with CONFIG_RESET_TO_RETRY)
100  */
101 # define CONFIG_BOOT_RETRY_TIME 30
102 # define CONFIG_RESET_TO_RETRY
103 #endif
104 
105 #define CONFIG_ENV_VARS_UBOOT_CONFIG
106 #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
107 
108 #ifndef CONFIG_SPL_BUILD
109 #define CONFIG_EXTRA_ENV_SETTINGS \
110 	"loadaddr=0x80200000\0" \
111 	"kloadaddr=0x84000000\0" \
112 	"fdtaddr=0x85000000\0" \
113 	"fdt_high=0xffffffff\0" \
114 	"rdaddr=0x81000000\0" \
115 	"bootfile=uImage\0" \
116 	"fdtfile=am335x-shc.dtb\0" \
117 	"verify=no\0" \
118 	"serverip=10.55.152.184\0" \
119 	"rootpath=/srv/nfs/shc-rootfs\0" \
120 	"console=ttyO0,115200n8\0" \
121 	"optargs=quiet\0" \
122 	"mmcdev=1\0" \
123 	"harakiri=0\0" \
124 	"mmcpart=2\0" \
125 	"active_root=root1\0" \
126 	"inactive_root=root2\0" \
127 	"mmcrootfstype=ext4 rootwait\0" \
128 	"nfsopts=nolock\0" \
129 	"static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}" \
130 		"::off\0" \
131 	"ip_method=none\0" \
132 	"bootargs_defaults=setenv bootargs " \
133 		"console=${console} " \
134 		"${optargs}\0" \
135 	"mmcargs=run bootargs_defaults;" \
136 		"setenv bootargs ${bootargs} " \
137 		"root=${mmcroot} " \
138 		"rootfstype=${mmcrootfstype} ip=${ip_method}\0" \
139 	"netargs=setenv bootargs console=${console} " \
140 		"${optargs} " \
141 		"root=/dev/nfs " \
142 		"nfsroot=${serverip}:${rootpath},${nfsopts} rw " \
143 		"ip=dhcp\0" \
144 	"bootenv=uEnv.txt\0" \
145 	"loadbootenv=if fatload mmc ${mmcdev} ${loadaddr} ${bootenv}; then " \
146 			"echo Loaded environment from ${bootenv}; " \
147 			"run importbootenv; " \
148 		"fi;\0" \
149 	"importbootenv=echo Importing environment variables from uEnv.txt ...; " \
150 		"env import -t $loadaddr $filesize\0" \
151 	"loaduimagefat=fatload mmc ${mmcdev} ${kloadaddr} ${bootfile}\0" \
152 	"loaduimage=ext2load mmc ${mmcdev}:${mmcpart} ${kloadaddr} /boot/${bootfile}\0" \
153 	"loadfdt=ext2load mmc ${mmcdev}:${mmcpart} ${fdtaddr} /boot/${fdtfile}\0" \
154 	"netloaduimage=tftp ${loadaddr} ${bootfile}\0" \
155 	"netloadfdt=tftp ${fdtaddr} ${fdtfile}\0" \
156 	"mmcboot=echo Booting Linux from ${mmcdevice} ...; " \
157 		"run mmcargs; " \
158 		"if run loadfdt; then " \
159 			"echo device tree detected; " \
160 			"bootm ${kloadaddr} - ${fdtaddr}; " \
161 		"else " \
162 			"bootm ${kloadaddr}; " \
163 		"fi; \0" \
164 	"netboot=echo Booting from network ...; " \
165 		"setenv autoload no; " \
166 		"dhcp; " \
167 		"run netloaduimage; " \
168 		"run netargs; " \
169 		"echo NFS path: ${serverip}:${rootpath};" \
170 		"if run netloadfdt; then " \
171 			"echo device tree detected; " \
172 			"bootm ${loadaddr} - ${fdtaddr}; " \
173 		"else " \
174 			"bootm ${loadaddr}; " \
175 		"fi; \0" \
176 	"emmc_erase=if test ${harakiri} = 1 ; then echo erase emmc ...; setenv mmcdev 1; mmc erase 0 200; reset; fi; \0" \
177 	"mmcpart_gp=mmcpart gp 1 40; \0" \
178 	"mmcpart_enhance=mmcpart enhance 0 64; \0" \
179 	"mmcpart_rel_write=mmcpart rel_write 1f; \0" \
180 	"mmcpart_commit=mmcpart commit 1; \0" \
181 	"mmc_hw_part=run mmcpart_gp; run mmcpart_enhance; run mmcpart_rel_write; run mmcpart_commit; \0" \
182 	"led_success=gpio set 22; \0" \
183 	"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" \
184 	"uenv_exec=if test -n $uenvcmd; then " \
185 			"echo Running uenvcmd ...; " \
186 			"run uenvcmd; " \
187 		"fi;\0" \
188 	"sd_setup=echo SD/MMC-Card detected on device 0; " \
189 		"setenv mmcdevice SD; " \
190 		"setenv mmcdev 0; " \
191 		"setenv mmcpart 2; " \
192 		"setenv mmcroot /dev/mmcblk${mmcdev}p${mmcpart};\0" \
193 	"emmc_setup=echo eMMC detected on device 1; " \
194 		"setenv mmcdevice eMMC; " \
195 		"setenv mmcdev 1; " \
196 		"run emmc_erase; " \
197 		"if test ${active_root} = root2; then " \
198 			"echo Active root is partition 6 (root2); " \
199 			"setenv mmcpart 6; " \
200 		"else " \
201 			"echo Active root is partition 5 (root1); " \
202 			"setenv mmcpart 5; " \
203 		"fi; " \
204 		"setenv mmcroot /dev/mmcblk${mmcdev}p${mmcpart};\0"
205 #endif /* #ifndef CONFIG_SPL_BUILD */
206 
207 #if defined CONFIG_SHC_NETBOOT
208 /* Network Boot */
209 # define CONFIG_BOOTCOMMAND \
210 	"run fusecmd; " \
211 	"if run netboot; then " \
212 		"echo Booting from network; " \
213 	"else " \
214 		"echo ERROR: Cannot boot from network!; " \
215 		"panic; " \
216 	"fi; "
217 
218 #elif defined CONFIG_SHC_SDBOOT /* !defined CONFIG_SHC_NETBOOT */
219 /* SD-Card Boot */
220 # define CONFIG_BOOTCOMMAND \
221 	"if mmc dev 0; mmc rescan; then " \
222 		"run sd_setup; " \
223 	"else " \
224 		"echo ERROR: SD/MMC-Card not detected!; " \
225 		"panic; " \
226 	"fi; " \
227 	"if run loaduimage; then " \
228 		"echo Bootable SD/MMC-Card inserted, booting from it!; " \
229 		"run mmcboot; " \
230 	"else " \
231 		"echo ERROR: Unable to load uImage from SD/MMC-Card!; " \
232 		"panic; " \
233 	"fi; "
234 
235 #elif defined CONFIG_SHC_ICT
236 /* ICT adapter boots only u-boot and does HW partitioning */
237 # define CONFIG_BOOTCOMMAND \
238 	"if mmc dev 0; mmc rescan; then " \
239 		"run sd_setup; " \
240 	"else " \
241 		"echo ERROR: SD/MMC-Card not detected!; " \
242 		"panic; " \
243 	"fi; " \
244 	"run fusecmd; "
245 
246 #else /* !defined CONFIG_SHC_NETBOOT, !defined CONFIG_SHC_SDBOOT */
247 /* Regular Boot from internal eMMC */
248 # define CONFIG_BOOTCOMMAND \
249 	"if mmc dev 1; mmc rescan; then " \
250 		"run emmc_setup; " \
251 	"else " \
252 		"echo ERROR: eMMC device not detected!; " \
253 		"panic; " \
254 	"fi; " \
255 	"if run loaduimage; then " \
256 		"run mmcboot; " \
257 	"else " \
258 		"echo ERROR Unable to load uImage from eMMC!; " \
259 		"echo Performing Rollback!; " \
260 		"setenv _active_ ${active_root}; " \
261 		"setenv _inactive_ ${inactive_root}; " \
262 		"setenv active_root ${_inactive_}; " \
263 		"setenv inactive_root ${_active_}; " \
264 		"saveenv; " \
265 		"reset; " \
266 	"fi; "
267 
268 #endif /* Regular Boot */
269 
270 /* NS16550 Configuration */
271 #define CONFIG_SYS_NS16550_COM1		0x44e09000	/* UART0 */
272 #define CONFIG_SYS_NS16550_COM2		0x48022000	/* UART1 */
273 #define CONFIG_SYS_NS16550_COM3		0x48024000	/* UART2 */
274 #define CONFIG_SYS_NS16550_COM4		0x481a6000	/* UART3 */
275 #define CONFIG_SYS_NS16550_COM5		0x481a8000	/* UART4 */
276 #define CONFIG_SYS_NS16550_COM6		0x481aa000	/* UART5 */
277 #define CONFIG_BAUDRATE			115200
278 #define CONFIG_CONS_INDEX               1
279 
280 /* PMIC support */
281 #define CONFIG_POWER_TPS65217
282 
283 /* SPL */
284 #define CONFIG_SPL_POWER_SUPPORT
285 #define CONFIG_SPL_YMODEM_SUPPORT
286 
287 #define CONFIG_SPL_LDSCRIPT		"$(CPUDIR)/am33xx/u-boot-spl.lds"
288 
289 #ifndef CONFIG_SPL_USBETH_SUPPORT
290 /* To support eMMC booting */
291 #define CONFIG_STORAGE_EMMC
292 #define CONFIG_FASTBOOT_FLASH_MMC_DEV   1
293 #endif
294 
295 /*
296  * Disable MMC DM for SPL build and can be re-enabled after adding
297  * DM support in SPL
298  */
299 #ifdef CONFIG_SPL_BUILD
300 #undef CONFIG_DM_MMC
301 #undef CONFIG_TIMER
302 #endif
303 
304 #define CONFIG_CMD_DHCP
305 #define CONFIG_CMD_PING
306 #define CONFIG_DRIVER_TI_CPSW
307 #define CONFIG_MII
308 #define CONFIG_BOOTP_DEFAULT
309 #define CONFIG_BOOTP_DNS
310 #define CONFIG_BOOTP_DNS2
311 #define CONFIG_BOOTP_SEND_HOSTNAME
312 #define CONFIG_BOOTP_GATEWAY
313 #define CONFIG_BOOTP_SUBNETMASK
314 #define CONFIG_NET_RETRY_COUNT         10
315 #define CONFIG_NET_MULTI
316 #define CONFIG_PHY_GIGE
317 #define CONFIG_PHYLIB
318 #define CONFIG_PHY_ADDR			0
319 #define CONFIG_PHY_SMSC
320 
321 /* I2C configuration */
322 #define CONFIG_SYS_I2C_EEPROM_ADDR	0x50	/* Main EEPROM */
323 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN	2
324 #define CONFIG_SYS_I2C_SPEED		400000
325 #define CONFIG_SYS_I2C_SLAVE		1
326 
327 #define CONFIG_SHOW_BOOT_PROGRESS
328 
329 #if defined CONFIG_SHC_NETBOOT
330 #ifdef CONFIG_SPL_BUILD
331 #define CONFIG_SPL_NET_SUPPORT
332 #define CONFIG_SPL_ETH_SUPPORT
333 #define CONFIG_SPL_NET_VCI_STRING	"AM335x U-Boot SPL"
334 #define CONFIG_SPL_ENV_SUPPORT
335 #define CONFIG_SPL_MMC_SUPPORT
336 #define CONFIG_ENV_IS_NOWHERE
337 #undef CONFIG_ENV_IS_IN_MMC
338 #endif
339 #endif
340 #endif	/* ! __CONFIG_AM335X_SHC_H */
341