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