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