1 /*
2  * am335x_evm.h
3  *
4  * Copyright (C) 2011 Texas Instruments Incorporated - https://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 /* Clock Defines */
23 #define V_OSCK				24000000  /* Clock output from T2 */
24 #define V_SCLK				(V_OSCK)
25 
26 /* FIT support */
27 
28 #ifdef CONFIG_MTD_RAW_NAND
29 
30 #define NANDARGS \
31 	"nandargs=setenv bootargs console=${console} " \
32 		"${optargs} " \
33 		"${mtdparts} " \
34 		"root=${nandroot} " \
35 		"rootfstype=${nandrootfstype}\0" \
36 	"nandroot=ubi0:rootfs rw ubi.mtd=5\0" \
37 	"nandrootfstype=ubifs rootwait\0" \
38 	"nandboot=echo Booting from nand ...; " \
39 		"run nandargs; " \
40 		"setenv loadaddr 0x84000000; " \
41 		"ubi part UBI; " \
42 		"ubifsmount ubi0:kernel; " \
43 		"ubifsload $loadaddr kernel-fit.itb;" \
44 		"ubifsumount; " \
45 		"bootm ${loadaddr}#conf${board_name}; " \
46 		"if test $? -ne 0; then echo Using default FIT config; " \
47 		"bootm ${loadaddr}; fi;\0"
48 #else
49 #define NANDARGS ""
50 #endif
51 
52 #define CFG_EXTRA_ENV_SETTINGS \
53 	DEFAULT_LINUX_BOOT_ENV \
54 	"boot_fdt=try\0" \
55 	"bootpart=0:2\0" \
56 	"bootdir=/boot\0" \
57 	"bootfile=zImage\0" \
58 	"fdtfile=undefined\0" \
59 	"console=ttyO0,115200n8\0" \
60 	"partitions=" \
61 		"uuid_disk=${uuid_gpt_disk};" \
62 		"name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}\0" \
63 	"optargs=\0" \
64 	"mmcdev=0\0" \
65 	"mmcroot=/dev/mmcblk0p2 ro\0" \
66 	"usbroot=/dev/sda2 ro\0" \
67 	"mmcrootfstype=ext4 rootwait\0" \
68 	"usbrootfstype=ext4 rootwait\0" \
69 	"rootpath=/export/rootfs\0" \
70 	"nfsopts=nolock\0" \
71 	"static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}" \
72 		"::off\0" \
73 	"ramroot=/dev/ram0 rw\0" \
74 	"ramrootfstype=ext2\0" \
75 	"mmcargs=setenv bootargs console=${console} " \
76 		"${optargs} " \
77 		"${mtdparts} " \
78 		"root=${mmcroot} " \
79 		"rootfstype=${mmcrootfstype}\0" \
80 	"usbargs=setenv bootargs console=${console} " \
81 		"${optargs} " \
82 		"${mtdparts} " \
83 		"root=${usbroot} " \
84 		"rootfstype=${usbrootfstype}\0" \
85 	"spiroot=/dev/mtdblock4 rw\0" \
86 	"spirootfstype=jffs2\0" \
87 	"spisrcaddr=0xe0000\0" \
88 	"spiimgsize=0x362000\0" \
89 	"spibusno=0\0" \
90 	"spiargs=setenv bootargs console=${console} " \
91 		"${optargs} " \
92 		"root=${spiroot} " \
93 		"rootfstype=${spirootfstype}\0" \
94 	"netargs=setenv bootargs console=${console} " \
95 		"${optargs} " \
96 		"root=/dev/nfs " \
97 		"nfsroot=${serverip}:${rootpath},${nfsopts} rw " \
98 		"ip=dhcp\0" \
99 	"bootenv=uEnv.txt\0" \
100 	"loadbootenv=load mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
101 	"usbloadbootenv=load usb 0:1 ${loadaddr} ${bootenv}\0" \
102 	"importbootenv=echo Importing environment from mmc ...; " \
103 		"env import -t $loadaddr $filesize\0" \
104 	"usbimportbootenv=echo Importing environment from USB ...; " \
105 		"env import -t $loadaddr $filesize\0" \
106 	"ramargs=setenv bootargs console=${console} " \
107 		"${optargs} " \
108 		"root=${ramroot} " \
109 		"rootfstype=${ramrootfstype}\0" \
110 	"loadramdisk=load mmc ${mmcdev} ${rdaddr} ramdisk.gz\0" \
111 	"loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
112 	"usbloadimage=load usb 0:1 ${loadaddr} kernel-fit.itb\0" \
113 	"loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
114 	"usbloados=run usbargs; " \
115 		"bootm ${loadaddr}#conf${board_name}; " \
116 		"if test $? -ne 0; then " \
117 			"echo Using default FIT configuration; " \
118 			"bootm ${loadaddr}; " \
119 		"fi;\0" \
120 	"mmcloados=run mmcargs; " \
121 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
122 			"if run loadfdt; then " \
123 				"bootz ${loadaddr} - ${fdtaddr}; " \
124 			"else " \
125 				"if test ${boot_fdt} = try; then " \
126 					"bootz; " \
127 				"else " \
128 					"echo WARN: Cannot load the DT; " \
129 				"fi; " \
130 			"fi; " \
131 		"else " \
132 			"bootz; " \
133 		"fi;\0" \
134 	"usbboot=usb reset; " \
135 		"if usb storage; then " \
136 			"echo USB drive found;" \
137 			"if run usbloadbootenv; then " \
138 				"echo Loaded environment from ${bootenv};" \
139 				"run usbimportbootenv;" \
140 			"fi;" \
141 			"if test -n $uenvcmd; then " \
142 				"echo Running uenvcmd ...;" \
143 				"run uenvcmd;" \
144 			"fi;" \
145 			"if run usbloadimage; then " \
146 				"run usbloados;" \
147 			"fi;" \
148 		"fi;\0" \
149 	"mmcboot=mmc dev ${mmcdev}; " \
150 		"if mmc rescan; then " \
151 			"echo SD/MMC found on device ${mmcdev};" \
152 			"if run loadbootenv; then " \
153 				"echo Loaded environment from ${bootenv};" \
154 				"run importbootenv;" \
155 			"fi;" \
156 			"if test -n $uenvcmd; then " \
157 				"echo Running uenvcmd ...;" \
158 				"run uenvcmd;" \
159 			"fi;" \
160 			"if run loadimage; then " \
161 				"run mmcloados;" \
162 			"fi;" \
163 		"fi;\0" \
164 	"spiboot=echo Booting from spi ...; " \
165 		"run spiargs; " \
166 		"sf probe ${spibusno}:0; " \
167 		"sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; " \
168 		"bootz ${loadaddr}\0" \
169 	"netboot=echo Booting from network ...; " \
170 		"setenv autoload no; " \
171 		"dhcp; " \
172 		"tftp ${loadaddr} ${bootfile}; " \
173 		"tftp ${fdtaddr} ${fdtfile}; " \
174 		"run netargs; " \
175 		"bootz ${loadaddr} - ${fdtaddr}\0" \
176 	"ramboot=echo Booting from ramdisk ...; " \
177 		"run ramargs; " \
178 		"bootz ${loadaddr} ${rdaddr} ${fdtaddr}\0" \
179 	"findfdt=setenv fdtfile am335x-baltos.dtb\0" \
180 	NANDARGS
181 	/*DFUARGS*/
182 
183 /* NS16550 Configuration */
184 #define CFG_SYS_NS16550_COM1		0x44e09000	/* Base EVM has UART0 */
185 #define CFG_SYS_NS16550_COM2		0x48022000	/* UART1 */
186 #define CFG_SYS_NS16550_COM3		0x48024000	/* UART2 */
187 #define CFG_SYS_NS16550_COM4		0x481a6000	/* UART3 */
188 #define CFG_SYS_NS16550_COM5		0x481a8000	/* UART4 */
189 #define CFG_SYS_NS16550_COM6		0x481aa000	/* UART5 */
190 
191 /* SPL */
192 #ifndef CONFIG_NOR_BOOT
193 
194 #ifdef CONFIG_MTD_RAW_NAND
195 #define CFG_SYS_NAND_ECCPOS		{ 2, 3, 4, 5, 6, 7, 8, 9, \
196 					 10, 11, 12, 13, 14, 15, 16, 17, \
197 					 18, 19, 20, 21, 22, 23, 24, 25, \
198 					 26, 27, 28, 29, 30, 31, 32, 33, \
199 					 34, 35, 36, 37, 38, 39, 40, 41, \
200 					 42, 43, 44, 45, 46, 47, 48, 49, \
201 					 50, 51, 52, 53, 54, 55, 56, 57, }
202 
203 #define CFG_SYS_NAND_ECCSIZE		512
204 #define CFG_SYS_NAND_ECCBYTES	14
205 #define CFG_SYS_NAND_U_BOOT_START	CONFIG_TEXT_BASE
206 #endif
207 #endif
208 
209 /* NAND support */
210 #ifdef CONFIG_MTD_RAW_NAND
211 #define GPMC_NAND_ECC_LP_x8_LAYOUT	1
212 #endif
213 
214 #endif	/* ! __CONFIG_BALTOS_H */
215