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