xref: /rk3399_rockchip-uboot/include/configs/baltos.h (revision 203dc1b3a8ea79190c8574c58b75a8aa5e5d9d1e)
1 /*
2  * am335x_evm.h
3  *
4  * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation version 2.
9  *
10  * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11  * kind, whether express or implied; without even the implied warranty
12  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  */
15 
16 #ifndef __CONFIG_BALTOS_H
17 #define __CONFIG_BALTOS_H
18 
19 #include <linux/sizes.h>
20 #include <configs/ti_am335x_common.h>
21 
22 #define CONFIG_MACH_TYPE		MACH_TYPE_AM335XEVM
23 
24 /* Clock Defines */
25 #define V_OSCK				24000000  /* Clock output from T2 */
26 #define V_SCLK				(V_OSCK)
27 
28 /* Custom script for NOR */
29 #define CONFIG_SYS_LDSCRIPT		"board/vscom/baltos/u-boot.lds"
30 
31 /* Always 128 KiB env size */
32 #define CONFIG_ENV_SIZE			(128 << 10)
33 
34 /* FIT support */
35 #define CONFIG_SYS_BOOTM_LEN         SZ_64M
36 
37 /* UBI Support */
38 #define CONFIG_MTD_PARTITIONS
39 #define CONFIG_MTD_DEVICE
40 
41 /* I2C configuration */
42 #undef CONFIG_SYS_OMAP24_I2C_SPEED
43 #define CONFIG_SYS_OMAP24_I2C_SPEED 1000
44 
45 #ifdef CONFIG_NAND
46 #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x00080000
47 #ifdef CONFIG_SPL_OS_BOOT
48 #define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x00200000 /* kernel offset */
49 #define CONFIG_CMD_SPL_WRITE_SIZE	0x2000
50 #endif
51 #define NANDARGS \
52 	"mtdids=" MTDIDS_DEFAULT "\0" \
53 	"mtdparts=" MTDPARTS_DEFAULT "\0" \
54 	"nandargs=setenv bootargs console=${console} " \
55 		"${optargs} " \
56 		"${mtdparts} " \
57 		"root=${nandroot} " \
58 		"rootfstype=${nandrootfstype}\0" \
59 	"nandroot=ubi0:rootfs rw ubi.mtd=5\0" \
60 	"nandrootfstype=ubifs rootwait=1\0" \
61 	"nandboot=echo Booting from nand ...; " \
62 		"run nandargs; " \
63 		"setenv loadaddr 0x84000000; " \
64 		"ubi part UBI; " \
65 		"ubifsmount ubi0:kernel; " \
66 		"ubifsload $loadaddr kernel-fit.itb;" \
67 		"ubifsumount; " \
68 		"bootm ${loadaddr}#conf${board_name}; " \
69 		"if test $? -ne 0; then echo Using default FIT config; " \
70 		"bootm ${loadaddr}; fi;\0"
71 #else
72 #define NANDARGS ""
73 #endif
74 
75 #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
76 
77 #ifndef CONFIG_SPL_BUILD
78 #define CONFIG_EXTRA_ENV_SETTINGS \
79 	DEFAULT_LINUX_BOOT_ENV \
80 	"boot_fdt=try\0" \
81 	"bootpart=0:2\0" \
82 	"bootdir=/boot\0" \
83 	"bootfile=zImage\0" \
84 	"fdtfile=undefined\0" \
85 	"console=ttyO0,115200n8\0" \
86 	"partitions=" \
87 		"uuid_disk=${uuid_gpt_disk};" \
88 		"name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}\0" \
89 	"optargs=\0" \
90 	"mmcdev=0\0" \
91 	"mmcroot=/dev/mmcblk0p2 ro\0" \
92 	"usbroot=/dev/sda2 ro\0" \
93 	"mmcrootfstype=ext4 rootwait\0" \
94 	"usbrootfstype=ext4 rootwait\0" \
95 	"rootpath=/export/rootfs\0" \
96 	"nfsopts=nolock\0" \
97 	"static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}" \
98 		"::off\0" \
99 	"ramroot=/dev/ram0 rw\0" \
100 	"ramrootfstype=ext2\0" \
101 	"mmcargs=setenv bootargs console=${console} " \
102 		"${optargs} " \
103 		"${mtdparts} " \
104 		"root=${mmcroot} " \
105 		"rootfstype=${mmcrootfstype}\0" \
106 	"usbargs=setenv bootargs console=${console} " \
107 		"${optargs} " \
108 		"${mtdparts} " \
109 		"root=${usbroot} " \
110 		"rootfstype=${usbrootfstype}\0" \
111 	"spiroot=/dev/mtdblock4 rw\0" \
112 	"spirootfstype=jffs2\0" \
113 	"spisrcaddr=0xe0000\0" \
114 	"spiimgsize=0x362000\0" \
115 	"spibusno=0\0" \
116 	"spiargs=setenv bootargs console=${console} " \
117 		"${optargs} " \
118 		"root=${spiroot} " \
119 		"rootfstype=${spirootfstype}\0" \
120 	"netargs=setenv bootargs console=${console} " \
121 		"${optargs} " \
122 		"root=/dev/nfs " \
123 		"nfsroot=${serverip}:${rootpath},${nfsopts} rw " \
124 		"ip=dhcp\0" \
125 	"bootenv=uEnv.txt\0" \
126 	"loadbootenv=load mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
127 	"usbloadbootenv=load usb 0:1 ${loadaddr} ${bootenv}\0" \
128 	"importbootenv=echo Importing environment from mmc ...; " \
129 		"env import -t $loadaddr $filesize\0" \
130 	"usbimportbootenv=echo Importing environment from USB ...; " \
131 		"env import -t $loadaddr $filesize\0" \
132 	"ramargs=setenv bootargs console=${console} " \
133 		"${optargs} " \
134 		"root=${ramroot} " \
135 		"rootfstype=${ramrootfstype}\0" \
136 	"loadramdisk=load mmc ${mmcdev} ${rdaddr} ramdisk.gz\0" \
137 	"loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
138 	"usbloadimage=load usb 0:1 ${loadaddr} kernel-fit.itb\0" \
139 	"loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
140 	"usbloados=run usbargs; " \
141 		"bootm ${loadaddr}#conf${board_name}; " \
142 		"if test $? -ne 0; then " \
143 			"echo Using default FIT configuration; " \
144 			"bootm ${loadaddr}; " \
145 		"fi;\0" \
146 	"mmcloados=run mmcargs; " \
147 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
148 			"if run loadfdt; then " \
149 				"bootz ${loadaddr} - ${fdtaddr}; " \
150 			"else " \
151 				"if test ${boot_fdt} = try; then " \
152 					"bootz; " \
153 				"else " \
154 					"echo WARN: Cannot load the DT; " \
155 				"fi; " \
156 			"fi; " \
157 		"else " \
158 			"bootz; " \
159 		"fi;\0" \
160 	"usbboot=usb reset; " \
161 		"if usb storage; then " \
162 			"echo USB drive found;" \
163 			"if run usbloadbootenv; then " \
164 				"echo Loaded environment from ${bootenv};" \
165 				"run usbimportbootenv;" \
166 			"fi;" \
167 			"if test -n $uenvcmd; then " \
168 				"echo Running uenvcmd ...;" \
169 				"run uenvcmd;" \
170 			"fi;" \
171 			"if run usbloadimage; then " \
172 				"run usbloados;" \
173 			"fi;" \
174 		"fi;\0" \
175 	"mmcboot=mmc dev ${mmcdev}; " \
176 		"if mmc rescan; then " \
177 			"echo SD/MMC found on device ${mmcdev};" \
178 			"if run loadbootenv; then " \
179 				"echo Loaded environment from ${bootenv};" \
180 				"run importbootenv;" \
181 			"fi;" \
182 			"if test -n $uenvcmd; then " \
183 				"echo Running uenvcmd ...;" \
184 				"run uenvcmd;" \
185 			"fi;" \
186 			"if run loadimage; then " \
187 				"run mmcloados;" \
188 			"fi;" \
189 		"fi;\0" \
190 	"spiboot=echo Booting from spi ...; " \
191 		"run spiargs; " \
192 		"sf probe ${spibusno}:0; " \
193 		"sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; " \
194 		"bootz ${loadaddr}\0" \
195 	"netboot=echo Booting from network ...; " \
196 		"setenv autoload no; " \
197 		"dhcp; " \
198 		"tftp ${loadaddr} ${bootfile}; " \
199 		"tftp ${fdtaddr} ${fdtfile}; " \
200 		"run netargs; " \
201 		"bootz ${loadaddr} - ${fdtaddr}\0" \
202 	"ramboot=echo Booting from ramdisk ...; " \
203 		"run ramargs; " \
204 		"bootz ${loadaddr} ${rdaddr} ${fdtaddr}\0" \
205 	"findfdt=setenv fdtfile am335x-baltos.dtb\0" \
206 	NANDARGS
207 	/*DFUARGS*/
208 #endif
209 
210 #define CONFIG_BOOTCOMMAND \
211 	"run findfdt; " \
212 	"run usbboot;" \
213 	"run mmcboot;" \
214 	"setenv mmcdev 1; " \
215 	"setenv bootpart 1:2; " \
216 	"run mmcboot;" \
217 	"run nandboot;"
218 
219 /* NS16550 Configuration */
220 #define CONFIG_SYS_NS16550_COM1		0x44e09000	/* Base EVM has UART0 */
221 #define CONFIG_SYS_NS16550_COM2		0x48022000	/* UART1 */
222 #define CONFIG_SYS_NS16550_COM3		0x48024000	/* UART2 */
223 #define CONFIG_SYS_NS16550_COM4		0x481a6000	/* UART3 */
224 #define CONFIG_SYS_NS16550_COM5		0x481a8000	/* UART4 */
225 #define CONFIG_SYS_NS16550_COM6		0x481aa000	/* UART5 */
226 
227 #define CONFIG_ENV_EEPROM_IS_ON_I2C
228 #define CONFIG_SYS_I2C_EEPROM_ADDR	0x50	/* Main EEPROM */
229 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN	2
230 
231 /* PMIC support */
232 #define CONFIG_POWER_TPS65910
233 
234 /* SPL */
235 #ifndef CONFIG_NOR_BOOT
236 /* Bootcount using the RTC block */
237 #define CONFIG_BOOTCOUNT_LIMIT
238 #define CONFIG_BOOTCOUNT_AM33XX
239 
240 /* USB gadget RNDIS */
241 
242 /* General network SPL, both CPSW and USB gadget RNDIS */
243 #define CONFIG_SPL_NET_VCI_STRING	"AM335x U-Boot SPL"*/
244 
245 #define CONFIG_SPL_LDSCRIPT		"arch/arm/mach-omap2/u-boot-spl.lds"
246 
247 #ifdef CONFIG_NAND
248 #define CONFIG_NAND_OMAP_GPMC
249 #define CONFIG_NAND_OMAP_GPMC_PREFETCH
250 #define CONFIG_NAND_OMAP_ELM
251 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
252 #define CONFIG_SYS_NAND_PAGE_COUNT	(CONFIG_SYS_NAND_BLOCK_SIZE / \
253 					 CONFIG_SYS_NAND_PAGE_SIZE)
254 #define CONFIG_SYS_NAND_PAGE_SIZE	2048
255 #define CONFIG_SYS_NAND_OOBSIZE		64
256 #define CONFIG_SYS_NAND_BLOCK_SIZE	(128*1024)
257 #define CONFIG_SYS_NAND_BAD_BLOCK_POS	NAND_LARGE_BADBLOCK_POS
258 #define CONFIG_SYS_NAND_ECCPOS		{ 2, 3, 4, 5, 6, 7, 8, 9, \
259 					 10, 11, 12, 13, 14, 15, 16, 17, \
260 					 18, 19, 20, 21, 22, 23, 24, 25, \
261 					 26, 27, 28, 29, 30, 31, 32, 33, \
262 					 34, 35, 36, 37, 38, 39, 40, 41, \
263 					 42, 43, 44, 45, 46, 47, 48, 49, \
264 					 50, 51, 52, 53, 54, 55, 56, 57, }
265 
266 #define CONFIG_SYS_NAND_ECCSIZE		512
267 #define CONFIG_SYS_NAND_ECCBYTES	14
268 #define CONFIG_SYS_NAND_ONFI_DETECTION
269 #define CONFIG_NAND_OMAP_ECCSCHEME	OMAP_ECC_BCH8_CODE_HW
270 #define CONFIG_SYS_NAND_U_BOOT_START	CONFIG_SYS_TEXT_BASE
271 #endif
272 #endif
273 
274 /*
275  * USB configuration.  We enable MUSB support, both for host and for
276  * gadget.  We set USB0 as peripheral and USB1 as host, based on the
277  * board schematic and physical port wired to each.  Then for host we
278  * add mass storage support and for gadget we add both RNDIS ethernet
279  * and DFU.
280  */
281 #define CONFIG_USB_MUSB_DSPS
282 #define CONFIG_USB_MUSB_PIO_ONLY
283 #define CONFIG_USB_MUSB_DISABLE_BULK_COMBINE_SPLIT
284 #define CONFIG_AM335X_USB0
285 #define CONFIG_AM335X_USB0_MODE	MUSB_HOST
286 #define CONFIG_AM335X_USB1
287 #define CONFIG_AM335X_USB1_MODE MUSB_OTG
288 
289 #ifdef CONFIG_USB_MUSB_GADGET
290 #define CONFIG_USB_ETHER
291 #define CONFIG_USB_ETH_RNDIS
292 #define CONFIG_USBNET_HOST_ADDR	"de:ad:be:af:00:00"
293 #endif /* CONFIG_USB_MUSB_GADGET */
294 
295 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_USBETH_SUPPORT)
296 /* disable host part of MUSB in SPL */
297 /* disable EFI partitions and partition UUID support */
298 /*
299  * Disable CPSW SPL support so we fit within the 101KiB limit.
300  */
301 #endif
302 
303 /* Network. */
304 #define CONFIG_PHY_ADDR			0
305 #define CONFIG_PHY_SMSC
306 #define CONFIG_MII
307 #define CONFIG_PHY_ATHEROS
308 
309 /* NAND support */
310 #ifdef CONFIG_NAND
311 #define GPMC_NAND_ECC_LP_x8_LAYOUT	1
312 #if !defined(CONFIG_SPI_BOOT) && !defined(CONFIG_NOR_BOOT)
313 #define MTDIDS_DEFAULT			"nand0=omap2-nand.0"
314 #define MTDPARTS_DEFAULT		"mtdparts=omap2-nand.0:128k(SPL)," \
315 					"128k(SPL.backup1)," \
316 					"128k(SPL.backup2)," \
317 					"128k(SPL.backup3)," \
318 					"1920k(u-boot)," \
319 					"-(UBI)"
320 #endif
321 #endif
322 
323 #endif	/* ! __CONFIG_BALTOS_H */
324