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