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