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