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