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