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