xref: /openbmc/u-boot/include/configs/mx28evk.h (revision 03ab5d13)
1 /*
2  * (C) Copyright 2011 Freescale Semiconductor, Inc.
3  * Author: Fabio Estevam <fabio.estevam@freescale.com>
4  *
5  * Based on m28evk.h:
6  * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
7  * on behalf of DENX Software Engineering GmbH
8  *
9  * SPDX-License-Identifier:	GPL-2.0+
10  */
11 #ifndef __CONFIGS_MX28EVK_H__
12 #define __CONFIGS_MX28EVK_H__
13 
14 /* System configurations */
15 #define CONFIG_MX28				/* i.MX28 SoC */
16 #define CONFIG_MACH_TYPE	MACH_TYPE_MX28EVK
17 
18 /* U-Boot Commands */
19 #define CONFIG_SYS_NO_FLASH
20 #define CONFIG_DISPLAY_CPUINFO
21 #define CONFIG_DOS_PARTITION
22 
23 #define CONFIG_CMD_DATE
24 #define CONFIG_CMD_NAND
25 #define CONFIG_CMD_NAND_TRIMFFS
26 #define CONFIG_VIDEO
27 
28 /* Memory configuration */
29 #define CONFIG_NR_DRAM_BANKS		1		/* 1 bank of DRAM */
30 #define PHYS_SDRAM_1			0x40000000	/* Base address */
31 #define PHYS_SDRAM_1_SIZE		0x40000000	/* Max 1 GB RAM */
32 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM_1
33 
34 /* Environment */
35 #ifndef CONFIG_ENV_IS_IN_SPI_FLASH
36 #define CONFIG_ENV_SIZE			(16 * 1024)
37 #else
38 #define CONFIG_ENV_SIZE			(4 * 1024)
39 #endif
40 #define CONFIG_ENV_OVERWRITE
41 
42 /* Environment is in MMC */
43 #if defined(CONFIG_CMD_MMC) && defined(CONFIG_ENV_IS_IN_MMC)
44 #define CONFIG_ENV_OFFSET		(256 * 1024)
45 #define CONFIG_SYS_MMC_ENV_DEV		0
46 #endif
47 
48 /* Environment is in NAND */
49 #if defined(CONFIG_CMD_NAND) && defined(CONFIG_ENV_IS_IN_NAND)
50 #define CONFIG_ENV_SIZE_REDUND		CONFIG_ENV_SIZE
51 #define CONFIG_ENV_SECT_SIZE		(128 * 1024)
52 #define CONFIG_ENV_RANGE		(512 * 1024)
53 #define CONFIG_ENV_OFFSET		0x300000
54 #define CONFIG_ENV_OFFSET_REDUND	\
55 		(CONFIG_ENV_OFFSET + CONFIG_ENV_RANGE)
56 #endif
57 
58 /* Environemnt is in SPI flash */
59 #if defined(CONFIG_CMD_SF) && defined(CONFIG_ENV_IS_IN_SPI_FLASH)
60 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
61 #define CONFIG_ENV_OFFSET		0x40000		/* 256K */
62 #define CONFIG_ENV_OFFSET_REDUND	(CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)
63 #define CONFIG_ENV_SECT_SIZE		0x1000
64 #define CONFIG_ENV_SPI_CS		0
65 #define CONFIG_ENV_SPI_BUS		2
66 #define CONFIG_ENV_SPI_MAX_HZ		24000000
67 #define CONFIG_ENV_SPI_MODE		SPI_MODE_0
68 #endif
69 
70 /* UBI and NAND partitioning */
71 #ifdef CONFIG_CMD_NAND
72 #define CONFIG_CMD_UBIFS
73 #define CONFIG_CMD_MTDPARTS
74 #define CONFIG_RBTREE
75 #define CONFIG_LZO
76 #define CONFIG_MTD_DEVICE
77 #define CONFIG_MTD_PARTITIONS
78 #define MTDIDS_DEFAULT			"nand0=gpmi-nand"
79 #define MTDPARTS_DEFAULT			\
80 	"mtdparts=gpmi-nand:"			\
81 		"3m(bootloader)ro,"		\
82 		"512k(environment),"		\
83 		"512k(redundant-environment),"	\
84 		"4m(kernel),"			\
85 		"512k(fdt),"			\
86 		"8m(ramdisk),"			\
87 		"-(filesystem)"
88 #endif
89 
90 /* FEC Ethernet on SoC */
91 #ifdef	CONFIG_CMD_NET
92 #define CONFIG_FEC_MXC
93 #define CONFIG_MX28_FEC_MAC_IN_OCOTP
94 #endif
95 
96 /* RTC */
97 #ifdef	CONFIG_CMD_DATE
98 #define	CONFIG_RTC_MXS
99 #endif
100 
101 /* USB */
102 #ifdef	CONFIG_CMD_USB
103 #define CONFIG_EHCI_MXS_PORT1
104 #define CONFIG_USB_MAX_CONTROLLER_COUNT	1
105 #define	CONFIG_USB_HOST_ETHER
106 #define	CONFIG_USB_ETHER_ASIX
107 #define	CONFIG_USB_ETHER_SMSC95XX
108 #endif
109 
110 /* SPI */
111 #ifdef CONFIG_CMD_SPI
112 #define CONFIG_DEFAULT_SPI_BUS		2
113 #define CONFIG_DEFAULT_SPI_MODE		SPI_MODE_0
114 
115 /* SPI Flash */
116 #ifdef CONFIG_CMD_SF
117 #define CONFIG_SF_DEFAULT_BUS		2
118 #define CONFIG_SF_DEFAULT_CS		0
119 /* this may vary and depends on the installed chip */
120 #define CONFIG_SF_DEFAULT_MODE		SPI_MODE_0
121 #define CONFIG_SF_DEFAULT_SPEED		24000000
122 #endif
123 
124 #endif
125 
126 /* Framebuffer support */
127 #ifdef CONFIG_VIDEO
128 #define CONFIG_VIDEO_LOGO
129 #define CONFIG_SPLASH_SCREEN
130 #define CONFIG_CMD_BMP
131 #define CONFIG_BMP_16BPP
132 #define CONFIG_VIDEO_BMP_RLE8
133 #define CONFIG_VIDEO_BMP_GZIP
134 #define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE	(512 << 10)
135 #endif
136 
137 /* Boot Linux */
138 #define CONFIG_BOOTFILE		"uImage"
139 #define CONFIG_LOADADDR		0x42000000
140 #define CONFIG_SYS_LOAD_ADDR	CONFIG_LOADADDR
141 
142 /* Extra Environment */
143 #define CONFIG_EXTRA_ENV_SETTINGS \
144 	"ubifs_file=filesystem.ubifs\0" \
145 	"update_nand_full_filename=u-boot.nand\0" \
146 	"update_nand_firmware_filename=u-boot.sb\0"	\
147 	"update_nand_firmware_maxsz=0x100000\0"	\
148 	"update_nand_stride=0x40\0"	/* MX28 datasheet ch. 12.12 */ \
149 	"update_nand_count=0x4\0"	/* MX28 datasheet ch. 12.12 */ \
150 	"update_nand_get_fcb_size="	/* Get size of FCB blocks */ \
151 		"nand device 0 ; " \
152 		"nand info ; " \
153 		"setexpr fcb_sz ${update_nand_stride} * ${update_nand_count};" \
154 		"setexpr update_nand_fcb ${fcb_sz} * ${nand_writesize}\0" \
155 	"update_nand_firmware_full=" /* Update FCB, DBBT and FW */ \
156 		"if tftp ${update_nand_full_filename} ; then " \
157 		"run update_nand_get_fcb_size ; " \
158 		"nand scrub -y 0x0 ${filesize} ; " \
159 		"nand write.raw ${loadaddr} 0x0 ${fcb_sz} ; " \
160 		"setexpr update_off ${loadaddr} + ${update_nand_fcb} ; " \
161 		"setexpr update_sz ${filesize} - ${update_nand_fcb} ; " \
162 		"nand write ${update_off} ${update_nand_fcb} ${update_sz} ; " \
163 		"fi\0" \
164 	"update_nand_firmware="		/* Update only firmware */ \
165 		"if tftp ${update_nand_firmware_filename} ; then " \
166 		"run update_nand_get_fcb_size ; " \
167 		"setexpr fcb_sz ${update_nand_fcb} * 2 ; " /* FCB + DBBT */ \
168 		"setexpr fw_sz ${update_nand_firmware_maxsz} * 2 ; " \
169 		"setexpr fw_off ${fcb_sz} + ${update_nand_firmware_maxsz};" \
170 		"nand erase ${fcb_sz} ${fw_sz} ; " \
171 		"nand write ${loadaddr} ${fcb_sz} ${filesize} ; " \
172 		"nand write ${loadaddr} ${fw_off} ${filesize} ; " \
173 		"fi\0" \
174 	"update_nand_kernel="		/* Update kernel */ \
175 		"mtdparts default; " \
176 		"nand erase.part kernel; " \
177 		"if test ${ip_dyn} = yes; then " \
178 			"setenv get_cmd dhcp; " \
179 		"else " \
180 			"setenv get_cmd tftp; " \
181 		"fi; " \
182 		"${get_cmd} ${image}; " \
183 		"nand write ${loadaddr} kernel ${filesize}\0" \
184 	"update_nand_fdt="		/* Update fdt */ \
185 		"mtdparts default; " \
186 		"nand erase.part fdt; " \
187 		"if test ${ip_dyn} = yes; then " \
188 			"setenv get_cmd dhcp; " \
189 		"else " \
190 			"setenv get_cmd tftp; " \
191 		"fi; " \
192 		"${get_cmd} ${fdt_file}; " \
193 		"nand write ${loadaddr} fdt ${filesize}\0" \
194 	"update_nand_filesystem="		/* Update filesystem */ \
195 		"mtdparts default; " \
196 		"nand erase.part filesystem; " \
197 		"if test ${ip_dyn} = yes; then " \
198 			"setenv get_cmd dhcp; " \
199 		"else " \
200 			"setenv get_cmd tftp; " \
201 		"fi; " \
202 		"${get_cmd} ${ubifs_file}; " \
203 		"ubi part filesystem; " \
204 		"ubi create filesystem; " \
205 		"ubi write ${loadaddr} filesystem ${filesize}\0" \
206 	"nandargs=setenv bootargs console=${console_mainline},${baudrate} " \
207 		"rootfstype=ubifs ubi.mtd=6 root=ubi0_0 ${mtdparts}\0" \
208 	"nandboot="		/* Boot from NAND */ \
209 		"mtdparts default; " \
210 		"run nandargs; " \
211 		"nand read ${loadaddr} kernel 0x00400000; " \
212 		"if test ${boot_fdt} = yes; then " \
213 			"nand read ${fdt_addr} fdt 0x00080000; " \
214 			"bootz ${loadaddr} - ${fdt_addr}; " \
215 		"else " \
216 			"if test ${boot_fdt} = no; then " \
217 				"bootz; " \
218 			"else " \
219 				"echo \"ERROR: Set boot_fdt to yes or no.\"; " \
220 			"fi; " \
221 		"fi\0" \
222 	"update_sd_firmware_filename=u-boot.sd\0" \
223 	"update_sd_firmware="		/* Update the SD firmware partition */ \
224 		"if mmc rescan ; then "	\
225 		"if tftp ${update_sd_firmware_filename} ; then " \
226 		"setexpr fw_sz ${filesize} / 0x200 ; "	/* SD block size */ \
227 		"setexpr fw_sz ${fw_sz} + 1 ; "	\
228 		"mmc write ${loadaddr} 0x800 ${fw_sz} ; " \
229 		"fi ; "	\
230 		"fi\0" \
231 	"script=boot.scr\0"	\
232 	"image=zImage\0" \
233 	"console_fsl=ttyAM0\0" \
234 	"console_mainline=ttyAMA0\0" \
235 	"fdt_file=imx28-evk.dtb\0" \
236 	"fdt_addr=0x41000000\0" \
237 	"boot_fdt=try\0" \
238 	"ip_dyn=yes\0" \
239 	"mmcdev=0\0" \
240 	"mmcpart=2\0" \
241 	"mmcroot=/dev/mmcblk0p3 rw rootwait\0" \
242 	"mmcargs=setenv bootargs console=${console_mainline},${baudrate} " \
243 		"root=${mmcroot}\0" \
244 	"loadbootscript="  \
245 		"fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
246 	"bootscript=echo Running bootscript from mmc ...; "	\
247 		"source\0" \
248 	"loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
249 	"loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
250 	"mmcboot=echo Booting from mmc ...; " \
251 		"run mmcargs; " \
252 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
253 			"if run loadfdt; then " \
254 				"bootz ${loadaddr} - ${fdt_addr}; " \
255 			"else " \
256 				"if test ${boot_fdt} = try; then " \
257 					"bootz; " \
258 				"else " \
259 					"echo WARN: Cannot load the DT; " \
260 				"fi; " \
261 			"fi; " \
262 		"else " \
263 			"bootz; " \
264 		"fi;\0" \
265 	"netargs=setenv bootargs console=${console_mainline},${baudrate} " \
266 		"root=/dev/nfs " \
267 		"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
268 	"netboot=echo Booting from net ...; " \
269 		"run netargs; "	\
270 		"if test ${ip_dyn} = yes; then " \
271 			"setenv get_cmd dhcp; " \
272 		"else " \
273 			"setenv get_cmd tftp; " \
274 		"fi; " \
275 		"${get_cmd} ${image}; " \
276 		"if test ${boot_fdt} = yes; then " \
277 			"if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
278 				"bootz ${loadaddr} - ${fdt_addr}; " \
279 			"else " \
280 				"if test ${boot_fdt} = try; then " \
281 					"bootz; " \
282 				"else " \
283 					"echo WARN: Cannot load the DT; " \
284 				"fi;" \
285 			"fi; " \
286 		"else " \
287 			"bootz; " \
288 		"fi;\0"
289 
290 #define CONFIG_BOOTCOMMAND \
291 	"mmc dev ${mmcdev}; if mmc rescan; then " \
292 		"if run loadbootscript; then " \
293 			"run bootscript; " \
294 		"else " \
295 			"if run loadimage; then " \
296 				"run mmcboot; " \
297 			"else run netboot; " \
298 			"fi; " \
299 		"fi; " \
300 	"else run netboot; fi"
301 
302 /* The rest of the configuration is shared */
303 #include <configs/mxs.h>
304 
305 #endif /* __CONFIGS_MX28EVK_H__ */
306