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