blob: 6e1a40c678f10a82579d67f92fe253c8dcb00269 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Heiko Schocherf1163962016-06-07 08:31:25 +02002/*
3 * (C) Copyright 2016
4 * Heiko Schocher, DENX Software Engineering, hs@denx.de.
5 *
6 * Based on:
7 * am335x_evm.h
8 *
9 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
Heiko Schocherf1163962016-06-07 08:31:25 +020010 */
11
12#ifndef __CONFIG_AM335X_SHC_H
13#define __CONFIG_AM335X_SHC_H
14
15#include <configs/ti_am335x_common.h>
16
17/* settings we don;t want on this board */
Heiko Schocherf1163962016-06-07 08:31:25 +020018#undef CONFIG_CMD_SPI
Heiko Schocherf1163962016-06-07 08:31:25 +020019
20#define CONFIG_CMD_CACHE
21
22#ifndef CONFIG_SPL_BUILD
23# define CONFIG_TIMESTAMP
Heiko Schocherf1163962016-06-07 08:31:25 +020024#endif
25
26#define CONFIG_SYS_BOOTM_LEN (16 << 20)
27
Heiko Schocherf1163962016-06-07 08:31:25 +020028/* Clock Defines */
29#define V_OSCK 24000000 /* Clock output from T2 */
30#define V_SCLK (V_OSCK)
31
Heiko Schocherf1163962016-06-07 08:31:25 +020032/*
33 * in case of SD Card or Network boot we want to have a possibility to
34 * debrick the shc, therefore do not read environment from eMMC
35 */
36#if defined(CONFIG_SHC_SDBOOT) || defined(CONFIG_SHC_NETBOOT)
37#define CONFIG_SYS_MMC_ENV_DEV 0
38#else
39#define CONFIG_SYS_MMC_ENV_DEV 1
40#endif
41
42/*
43 * Info when using boot partitions: As environment resides within first
44 * 128 kB, MLO must start at 128 kB == 0x20000
45 * ENV at MMC Boot0 Partition - 0/Undefined=user, 1=boot0, 2=boot1,
46 * 4..7=general0..3
47 */
Heiko Schocherf1163962016-06-07 08:31:25 +020048
49#define CONFIG_HSMMC2_8BIT
50
Heiko Schocherf1163962016-06-07 08:31:25 +020051#ifndef CONFIG_SHC_ICT
52/*
53 * In builds other than ICT, reset to retry after timeout
54 * Define a timeout after which a stopped bootloader continues autoboot
55 * (only works with CONFIG_RESET_TO_RETRY)
56 */
57# define CONFIG_BOOT_RETRY_TIME 30
58# define CONFIG_RESET_TO_RETRY
59#endif
60
Heiko Schocherf1163962016-06-07 08:31:25 +020061#ifndef CONFIG_SPL_BUILD
62#define CONFIG_EXTRA_ENV_SETTINGS \
63 "loadaddr=0x80200000\0" \
64 "kloadaddr=0x84000000\0" \
65 "fdtaddr=0x85000000\0" \
66 "fdt_high=0xffffffff\0" \
67 "rdaddr=0x81000000\0" \
68 "bootfile=uImage\0" \
69 "fdtfile=am335x-shc.dtb\0" \
70 "verify=no\0" \
71 "serverip=10.55.152.184\0" \
72 "rootpath=/srv/nfs/shc-rootfs\0" \
73 "console=ttyO0,115200n8\0" \
74 "optargs=quiet\0" \
75 "mmcdev=1\0" \
76 "harakiri=0\0" \
77 "mmcpart=2\0" \
78 "active_root=root1\0" \
79 "inactive_root=root2\0" \
80 "mmcrootfstype=ext4 rootwait\0" \
81 "nfsopts=nolock\0" \
82 "static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}" \
83 "::off\0" \
84 "ip_method=none\0" \
85 "bootargs_defaults=setenv bootargs " \
86 "console=${console} " \
87 "${optargs}\0" \
88 "mmcargs=run bootargs_defaults;" \
89 "setenv bootargs ${bootargs} " \
90 "root=${mmcroot} " \
91 "rootfstype=${mmcrootfstype} ip=${ip_method}\0" \
92 "netargs=setenv bootargs console=${console} " \
93 "${optargs} " \
94 "root=/dev/nfs " \
95 "nfsroot=${serverip}:${rootpath},${nfsopts} rw " \
96 "ip=dhcp\0" \
97 "bootenv=uEnv.txt\0" \
98 "loadbootenv=if fatload mmc ${mmcdev} ${loadaddr} ${bootenv}; then " \
99 "echo Loaded environment from ${bootenv}; " \
100 "run importbootenv; " \
101 "fi;\0" \
102 "importbootenv=echo Importing environment variables from uEnv.txt ...; " \
103 "env import -t $loadaddr $filesize\0" \
104 "loaduimagefat=fatload mmc ${mmcdev} ${kloadaddr} ${bootfile}\0" \
105 "loaduimage=ext2load mmc ${mmcdev}:${mmcpart} ${kloadaddr} /boot/${bootfile}\0" \
106 "loadfdt=ext2load mmc ${mmcdev}:${mmcpart} ${fdtaddr} /boot/${fdtfile}\0" \
107 "netloaduimage=tftp ${loadaddr} ${bootfile}\0" \
108 "netloadfdt=tftp ${fdtaddr} ${fdtfile}\0" \
109 "mmcboot=echo Booting Linux from ${mmcdevice} ...; " \
110 "run mmcargs; " \
111 "if run loadfdt; then " \
112 "echo device tree detected; " \
113 "bootm ${kloadaddr} - ${fdtaddr}; " \
114 "else " \
115 "bootm ${kloadaddr}; " \
116 "fi; \0" \
117 "netboot=echo Booting from network ...; " \
118 "setenv autoload no; " \
119 "dhcp; " \
120 "run netloaduimage; " \
121 "run netargs; " \
122 "echo NFS path: ${serverip}:${rootpath};" \
123 "if run netloadfdt; then " \
124 "echo device tree detected; " \
125 "bootm ${loadaddr} - ${fdtaddr}; " \
126 "else " \
127 "bootm ${loadaddr}; " \
128 "fi; \0" \
129 "emmc_erase=if test ${harakiri} = 1 ; then echo erase emmc ...; setenv mmcdev 1; mmc erase 0 200; reset; fi; \0" \
130 "mmcpart_gp=mmcpart gp 1 40; \0" \
131 "mmcpart_enhance=mmcpart enhance 0 64; \0" \
132 "mmcpart_rel_write=mmcpart rel_write 1f; \0" \
133 "mmcpart_commit=mmcpart commit 1; \0" \
134 "mmc_hw_part=run mmcpart_gp; run mmcpart_enhance; run mmcpart_rel_write; run mmcpart_commit; \0" \
135 "led_success=gpio set 22; \0" \
136 "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" \
137 "uenv_exec=if test -n $uenvcmd; then " \
138 "echo Running uenvcmd ...; " \
139 "run uenvcmd; " \
140 "fi;\0" \
141 "sd_setup=echo SD/MMC-Card detected on device 0; " \
142 "setenv mmcdevice SD; " \
143 "setenv mmcdev 0; " \
144 "setenv mmcpart 2; " \
145 "setenv mmcroot /dev/mmcblk${mmcdev}p${mmcpart};\0" \
146 "emmc_setup=echo eMMC detected on device 1; " \
147 "setenv mmcdevice eMMC; " \
148 "setenv mmcdev 1; " \
149 "run emmc_erase; " \
150 "if test ${active_root} = root2; then " \
151 "echo Active root is partition 6 (root2); " \
152 "setenv mmcpart 6; " \
153 "else " \
154 "echo Active root is partition 5 (root1); " \
155 "setenv mmcpart 5; " \
156 "fi; " \
157 "setenv mmcroot /dev/mmcblk${mmcdev}p${mmcpart};\0"
158#endif /* #ifndef CONFIG_SPL_BUILD */
159
160#if defined CONFIG_SHC_NETBOOT
161/* Network Boot */
162# define CONFIG_BOOTCOMMAND \
163 "run fusecmd; " \
164 "if run netboot; then " \
165 "echo Booting from network; " \
166 "else " \
167 "echo ERROR: Cannot boot from network!; " \
168 "panic; " \
169 "fi; "
170
171#elif defined CONFIG_SHC_SDBOOT /* !defined CONFIG_SHC_NETBOOT */
172/* SD-Card Boot */
173# define CONFIG_BOOTCOMMAND \
174 "if mmc dev 0; mmc rescan; then " \
175 "run sd_setup; " \
176 "else " \
177 "echo ERROR: SD/MMC-Card not detected!; " \
178 "panic; " \
179 "fi; " \
180 "if run loaduimage; then " \
181 "echo Bootable SD/MMC-Card inserted, booting from it!; " \
182 "run mmcboot; " \
183 "else " \
184 "echo ERROR: Unable to load uImage from SD/MMC-Card!; " \
185 "panic; " \
186 "fi; "
187
188#elif defined CONFIG_SHC_ICT
189/* ICT adapter boots only u-boot and does HW partitioning */
190# define CONFIG_BOOTCOMMAND \
191 "if mmc dev 0; mmc rescan; then " \
192 "run sd_setup; " \
193 "else " \
194 "echo ERROR: SD/MMC-Card not detected!; " \
195 "panic; " \
196 "fi; " \
197 "run fusecmd; "
198
199#else /* !defined CONFIG_SHC_NETBOOT, !defined CONFIG_SHC_SDBOOT */
200/* Regular Boot from internal eMMC */
201# define CONFIG_BOOTCOMMAND \
202 "if mmc dev 1; mmc rescan; then " \
203 "run emmc_setup; " \
204 "else " \
205 "echo ERROR: eMMC device not detected!; " \
206 "panic; " \
207 "fi; " \
208 "if run loaduimage; then " \
209 "run mmcboot; " \
210 "else " \
211 "echo ERROR Unable to load uImage from eMMC!; " \
212 "echo Performing Rollback!; " \
213 "setenv _active_ ${active_root}; " \
214 "setenv _inactive_ ${inactive_root}; " \
215 "setenv active_root ${_inactive_}; " \
216 "setenv inactive_root ${_active_}; " \
217 "saveenv; " \
218 "reset; " \
219 "fi; "
220
221#endif /* Regular Boot */
222
223/* NS16550 Configuration */
224#define CONFIG_SYS_NS16550_COM1 0x44e09000 /* UART0 */
225#define CONFIG_SYS_NS16550_COM2 0x48022000 /* UART1 */
226#define CONFIG_SYS_NS16550_COM3 0x48024000 /* UART2 */
227#define CONFIG_SYS_NS16550_COM4 0x481a6000 /* UART3 */
228#define CONFIG_SYS_NS16550_COM5 0x481a8000 /* UART4 */
229#define CONFIG_SYS_NS16550_COM6 0x481aa000 /* UART5 */
Heiko Schocherf1163962016-06-07 08:31:25 +0200230
231/* PMIC support */
232#define CONFIG_POWER_TPS65217
233
234/* SPL */
Heiko Schocherf1163962016-06-07 08:31:25 +0200235
Heiko Schocherf1163962016-06-07 08:31:25 +0200236/*
237 * Disable MMC DM for SPL build and can be re-enabled after adding
238 * DM support in SPL
239 */
240#ifdef CONFIG_SPL_BUILD
241#undef CONFIG_DM_MMC
242#undef CONFIG_TIMER
243#endif
244
Heiko Schocherf1163962016-06-07 08:31:25 +0200245#define CONFIG_BOOTP_DEFAULT
Heiko Schocherf1163962016-06-07 08:31:25 +0200246#define CONFIG_BOOTP_DNS2
247#define CONFIG_BOOTP_SEND_HOSTNAME
Heiko Schocherf1163962016-06-07 08:31:25 +0200248#define CONFIG_NET_RETRY_COUNT 10
Heiko Schocherf1163962016-06-07 08:31:25 +0200249
250/* I2C configuration */
251#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* Main EEPROM */
252#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
253#define CONFIG_SYS_I2C_SPEED 400000
254#define CONFIG_SYS_I2C_SLAVE 1
Heiko Schocherf1163962016-06-07 08:31:25 +0200255#endif /* ! __CONFIG_AM335X_SHC_H */