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