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