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