]>
Commit | Line | Data |
---|---|---|
d8ccbe93 HS |
1 | /* |
2 | * (C) Copyright 2016 | |
3 | * Heiko Schocher, DENX Software Engineering, [email protected]. | |
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 | |
d8ccbe93 HS |
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 */ | |
d8ccbe93 HS |
53 | /* Clock Defines */ |
54 | #define V_OSCK 24000000 /* Clock output from T2 */ | |
55 | #define V_SCLK (V_OSCK) | |
56 | ||
d8ccbe93 HS |
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 | |
d8ccbe93 HS |
85 | #ifndef CONFIG_SHC_ICT |
86 | /* | |
87 | * In builds other than ICT, reset to retry after timeout | |
88 | * Define a timeout after which a stopped bootloader continues autoboot | |
89 | * (only works with CONFIG_RESET_TO_RETRY) | |
90 | */ | |
91 | # define CONFIG_BOOT_RETRY_TIME 30 | |
92 | # define CONFIG_RESET_TO_RETRY | |
93 | #endif | |
94 | ||
95 | #define CONFIG_ENV_VARS_UBOOT_CONFIG | |
96 | #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG | |
97 | ||
98 | #ifndef CONFIG_SPL_BUILD | |
99 | #define CONFIG_EXTRA_ENV_SETTINGS \ | |
100 | "loadaddr=0x80200000\0" \ | |
101 | "kloadaddr=0x84000000\0" \ | |
102 | "fdtaddr=0x85000000\0" \ | |
103 | "fdt_high=0xffffffff\0" \ | |
104 | "rdaddr=0x81000000\0" \ | |
105 | "bootfile=uImage\0" \ | |
106 | "fdtfile=am335x-shc.dtb\0" \ | |
107 | "verify=no\0" \ | |
108 | "serverip=10.55.152.184\0" \ | |
109 | "rootpath=/srv/nfs/shc-rootfs\0" \ | |
110 | "console=ttyO0,115200n8\0" \ | |
111 | "optargs=quiet\0" \ | |
112 | "mmcdev=1\0" \ | |
113 | "harakiri=0\0" \ | |
114 | "mmcpart=2\0" \ | |
115 | "active_root=root1\0" \ | |
116 | "inactive_root=root2\0" \ | |
117 | "mmcrootfstype=ext4 rootwait\0" \ | |
118 | "nfsopts=nolock\0" \ | |
119 | "static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}" \ | |
120 | "::off\0" \ | |
121 | "ip_method=none\0" \ | |
122 | "bootargs_defaults=setenv bootargs " \ | |
123 | "console=${console} " \ | |
124 | "${optargs}\0" \ | |
125 | "mmcargs=run bootargs_defaults;" \ | |
126 | "setenv bootargs ${bootargs} " \ | |
127 | "root=${mmcroot} " \ | |
128 | "rootfstype=${mmcrootfstype} ip=${ip_method}\0" \ | |
129 | "netargs=setenv bootargs console=${console} " \ | |
130 | "${optargs} " \ | |
131 | "root=/dev/nfs " \ | |
132 | "nfsroot=${serverip}:${rootpath},${nfsopts} rw " \ | |
133 | "ip=dhcp\0" \ | |
134 | "bootenv=uEnv.txt\0" \ | |
135 | "loadbootenv=if fatload mmc ${mmcdev} ${loadaddr} ${bootenv}; then " \ | |
136 | "echo Loaded environment from ${bootenv}; " \ | |
137 | "run importbootenv; " \ | |
138 | "fi;\0" \ | |
139 | "importbootenv=echo Importing environment variables from uEnv.txt ...; " \ | |
140 | "env import -t $loadaddr $filesize\0" \ | |
141 | "loaduimagefat=fatload mmc ${mmcdev} ${kloadaddr} ${bootfile}\0" \ | |
142 | "loaduimage=ext2load mmc ${mmcdev}:${mmcpart} ${kloadaddr} /boot/${bootfile}\0" \ | |
143 | "loadfdt=ext2load mmc ${mmcdev}:${mmcpart} ${fdtaddr} /boot/${fdtfile}\0" \ | |
144 | "netloaduimage=tftp ${loadaddr} ${bootfile}\0" \ | |
145 | "netloadfdt=tftp ${fdtaddr} ${fdtfile}\0" \ | |
146 | "mmcboot=echo Booting Linux from ${mmcdevice} ...; " \ | |
147 | "run mmcargs; " \ | |
148 | "if run loadfdt; then " \ | |
149 | "echo device tree detected; " \ | |
150 | "bootm ${kloadaddr} - ${fdtaddr}; " \ | |
151 | "else " \ | |
152 | "bootm ${kloadaddr}; " \ | |
153 | "fi; \0" \ | |
154 | "netboot=echo Booting from network ...; " \ | |
155 | "setenv autoload no; " \ | |
156 | "dhcp; " \ | |
157 | "run netloaduimage; " \ | |
158 | "run netargs; " \ | |
159 | "echo NFS path: ${serverip}:${rootpath};" \ | |
160 | "if run netloadfdt; then " \ | |
161 | "echo device tree detected; " \ | |
162 | "bootm ${loadaddr} - ${fdtaddr}; " \ | |
163 | "else " \ | |
164 | "bootm ${loadaddr}; " \ | |
165 | "fi; \0" \ | |
166 | "emmc_erase=if test ${harakiri} = 1 ; then echo erase emmc ...; setenv mmcdev 1; mmc erase 0 200; reset; fi; \0" \ | |
167 | "mmcpart_gp=mmcpart gp 1 40; \0" \ | |
168 | "mmcpart_enhance=mmcpart enhance 0 64; \0" \ | |
169 | "mmcpart_rel_write=mmcpart rel_write 1f; \0" \ | |
170 | "mmcpart_commit=mmcpart commit 1; \0" \ | |
171 | "mmc_hw_part=run mmcpart_gp; run mmcpart_enhance; run mmcpart_rel_write; run mmcpart_commit; \0" \ | |
172 | "led_success=gpio set 22; \0" \ | |
173 | "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" \ | |
174 | "uenv_exec=if test -n $uenvcmd; then " \ | |
175 | "echo Running uenvcmd ...; " \ | |
176 | "run uenvcmd; " \ | |
177 | "fi;\0" \ | |
178 | "sd_setup=echo SD/MMC-Card detected on device 0; " \ | |
179 | "setenv mmcdevice SD; " \ | |
180 | "setenv mmcdev 0; " \ | |
181 | "setenv mmcpart 2; " \ | |
182 | "setenv mmcroot /dev/mmcblk${mmcdev}p${mmcpart};\0" \ | |
183 | "emmc_setup=echo eMMC detected on device 1; " \ | |
184 | "setenv mmcdevice eMMC; " \ | |
185 | "setenv mmcdev 1; " \ | |
186 | "run emmc_erase; " \ | |
187 | "if test ${active_root} = root2; then " \ | |
188 | "echo Active root is partition 6 (root2); " \ | |
189 | "setenv mmcpart 6; " \ | |
190 | "else " \ | |
191 | "echo Active root is partition 5 (root1); " \ | |
192 | "setenv mmcpart 5; " \ | |
193 | "fi; " \ | |
194 | "setenv mmcroot /dev/mmcblk${mmcdev}p${mmcpart};\0" | |
195 | #endif /* #ifndef CONFIG_SPL_BUILD */ | |
196 | ||
197 | #if defined CONFIG_SHC_NETBOOT | |
198 | /* Network Boot */ | |
199 | # define CONFIG_BOOTCOMMAND \ | |
200 | "run fusecmd; " \ | |
201 | "if run netboot; then " \ | |
202 | "echo Booting from network; " \ | |
203 | "else " \ | |
204 | "echo ERROR: Cannot boot from network!; " \ | |
205 | "panic; " \ | |
206 | "fi; " | |
207 | ||
208 | #elif defined CONFIG_SHC_SDBOOT /* !defined CONFIG_SHC_NETBOOT */ | |
209 | /* SD-Card Boot */ | |
210 | # define CONFIG_BOOTCOMMAND \ | |
211 | "if mmc dev 0; mmc rescan; then " \ | |
212 | "run sd_setup; " \ | |
213 | "else " \ | |
214 | "echo ERROR: SD/MMC-Card not detected!; " \ | |
215 | "panic; " \ | |
216 | "fi; " \ | |
217 | "if run loaduimage; then " \ | |
218 | "echo Bootable SD/MMC-Card inserted, booting from it!; " \ | |
219 | "run mmcboot; " \ | |
220 | "else " \ | |
221 | "echo ERROR: Unable to load uImage from SD/MMC-Card!; " \ | |
222 | "panic; " \ | |
223 | "fi; " | |
224 | ||
225 | #elif defined CONFIG_SHC_ICT | |
226 | /* ICT adapter boots only u-boot and does HW partitioning */ | |
227 | # define CONFIG_BOOTCOMMAND \ | |
228 | "if mmc dev 0; mmc rescan; then " \ | |
229 | "run sd_setup; " \ | |
230 | "else " \ | |
231 | "echo ERROR: SD/MMC-Card not detected!; " \ | |
232 | "panic; " \ | |
233 | "fi; " \ | |
234 | "run fusecmd; " | |
235 | ||
236 | #else /* !defined CONFIG_SHC_NETBOOT, !defined CONFIG_SHC_SDBOOT */ | |
237 | /* Regular Boot from internal eMMC */ | |
238 | # define CONFIG_BOOTCOMMAND \ | |
239 | "if mmc dev 1; mmc rescan; then " \ | |
240 | "run emmc_setup; " \ | |
241 | "else " \ | |
242 | "echo ERROR: eMMC device not detected!; " \ | |
243 | "panic; " \ | |
244 | "fi; " \ | |
245 | "if run loaduimage; then " \ | |
246 | "run mmcboot; " \ | |
247 | "else " \ | |
248 | "echo ERROR Unable to load uImage from eMMC!; " \ | |
249 | "echo Performing Rollback!; " \ | |
250 | "setenv _active_ ${active_root}; " \ | |
251 | "setenv _inactive_ ${inactive_root}; " \ | |
252 | "setenv active_root ${_inactive_}; " \ | |
253 | "setenv inactive_root ${_active_}; " \ | |
254 | "saveenv; " \ | |
255 | "reset; " \ | |
256 | "fi; " | |
257 | ||
258 | #endif /* Regular Boot */ | |
259 | ||
260 | /* NS16550 Configuration */ | |
261 | #define CONFIG_SYS_NS16550_COM1 0x44e09000 /* UART0 */ | |
262 | #define CONFIG_SYS_NS16550_COM2 0x48022000 /* UART1 */ | |
263 | #define CONFIG_SYS_NS16550_COM3 0x48024000 /* UART2 */ | |
264 | #define CONFIG_SYS_NS16550_COM4 0x481a6000 /* UART3 */ | |
265 | #define CONFIG_SYS_NS16550_COM5 0x481a8000 /* UART4 */ | |
266 | #define CONFIG_SYS_NS16550_COM6 0x481aa000 /* UART5 */ | |
267 | #define CONFIG_BAUDRATE 115200 | |
268 | #define CONFIG_CONS_INDEX 1 | |
269 | ||
270 | /* PMIC support */ | |
271 | #define CONFIG_POWER_TPS65217 | |
272 | ||
273 | /* SPL */ | |
d8ccbe93 | 274 | |
983e3700 | 275 | #define CONFIG_SPL_LDSCRIPT "arch/arm/mach-omap2/am33xx/u-boot-spl.lds" |
d8ccbe93 HS |
276 | |
277 | #ifndef CONFIG_SPL_USBETH_SUPPORT | |
d8ccbe93 HS |
278 | #define CONFIG_FASTBOOT_FLASH_MMC_DEV 1 |
279 | #endif | |
280 | ||
281 | /* | |
282 | * Disable MMC DM for SPL build and can be re-enabled after adding | |
283 | * DM support in SPL | |
284 | */ | |
285 | #ifdef CONFIG_SPL_BUILD | |
286 | #undef CONFIG_DM_MMC | |
287 | #undef CONFIG_TIMER | |
288 | #endif | |
289 | ||
290 | #define CONFIG_CMD_DHCP | |
291 | #define CONFIG_CMD_PING | |
292 | #define CONFIG_DRIVER_TI_CPSW | |
293 | #define CONFIG_MII | |
294 | #define CONFIG_BOOTP_DEFAULT | |
295 | #define CONFIG_BOOTP_DNS | |
296 | #define CONFIG_BOOTP_DNS2 | |
297 | #define CONFIG_BOOTP_SEND_HOSTNAME | |
298 | #define CONFIG_BOOTP_GATEWAY | |
299 | #define CONFIG_BOOTP_SUBNETMASK | |
300 | #define CONFIG_NET_RETRY_COUNT 10 | |
301 | #define CONFIG_NET_MULTI | |
302 | #define CONFIG_PHY_GIGE | |
303 | #define CONFIG_PHYLIB | |
304 | #define CONFIG_PHY_ADDR 0 | |
305 | #define CONFIG_PHY_SMSC | |
306 | ||
307 | /* I2C configuration */ | |
308 | #define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* Main EEPROM */ | |
309 | #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2 | |
310 | #define CONFIG_SYS_I2C_SPEED 400000 | |
311 | #define CONFIG_SYS_I2C_SLAVE 1 | |
312 | ||
313 | #define CONFIG_SHOW_BOOT_PROGRESS | |
314 | ||
315 | #if defined CONFIG_SHC_NETBOOT | |
316 | #ifdef CONFIG_SPL_BUILD | |
d8ccbe93 HS |
317 | #define CONFIG_ENV_IS_NOWHERE |
318 | #undef CONFIG_ENV_IS_IN_MMC | |
319 | #endif | |
320 | #endif | |
321 | #endif /* ! __CONFIG_AM335X_SHC_H */ |