1 /*
2  * Copyright (C) 2012 Freescale Semiconductor, Inc.
3  *
4  * Configuration settings for the Freescale i.MX6Q SabreSD board.
5  *
6  * SPDX-License-Identifier:	GPL-2.0+
7  */
8 
9 #ifndef __MX6QSABRE_COMMON_CONFIG_H
10 #define __MX6QSABRE_COMMON_CONFIG_H
11 
12 #include "mx6_common.h"
13 
14 #define CONFIG_IMX_THERMAL
15 
16 /* Size of malloc() pool */
17 #define CONFIG_SYS_MALLOC_LEN		(10 * SZ_1M)
18 
19 #define CONFIG_BOARD_EARLY_INIT_F
20 
21 #define CONFIG_MXC_UART
22 
23 /* MMC Configs */
24 #define CONFIG_SYS_FSL_ESDHC_ADDR      0
25 
26 #define CONFIG_FEC_MXC
27 #define CONFIG_MII
28 #define IMX_FEC_BASE			ENET_BASE_ADDR
29 #define CONFIG_FEC_XCV_TYPE		RGMII
30 #define CONFIG_ETHPRIME			"FEC"
31 #define CONFIG_FEC_MXC_PHYADDR		1
32 
33 #define CONFIG_PHYLIB
34 #define CONFIG_PHY_ATHEROS
35 
36 #ifdef CONFIG_CMD_SF
37 #define CONFIG_MXC_SPI
38 #define CONFIG_SF_DEFAULT_BUS		0
39 #define CONFIG_SF_DEFAULT_CS		0
40 #define CONFIG_SF_DEFAULT_SPEED		20000000
41 #define CONFIG_SF_DEFAULT_MODE		SPI_MODE_0
42 #endif
43 
44 /* Command definition */
45 #define CONFIG_CMD_BMODE
46 
47 #ifdef CONFIG_SUPPORT_EMMC_BOOT
48 #define EMMC_ENV \
49 	"emmcdev=2\0" \
50 	"update_emmc_firmware=" \
51 		"if test ${ip_dyn} = yes; then " \
52 			"setenv get_cmd dhcp; " \
53 		"else " \
54 			"setenv get_cmd tftp; " \
55 		"fi; " \
56 		"if ${get_cmd} ${update_sd_firmware_filename}; then " \
57 			"if mmc dev ${emmcdev} 1; then "	\
58 				"setexpr fw_sz ${filesize} / 0x200; " \
59 				"setexpr fw_sz ${fw_sz} + 1; "	\
60 				"mmc write ${loadaddr} 0x2 ${fw_sz}; " \
61 			"fi; "	\
62 		"fi\0"
63 #else
64 #define EMMC_ENV ""
65 #endif
66 
67 #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
68 
69 #define CONFIG_EXTRA_ENV_SETTINGS \
70 	"script=boot.scr\0" \
71 	"image=zImage\0" \
72 	"fdt_file=undefined\0" \
73 	"fdt_addr=0x18000000\0" \
74 	"boot_fdt=try\0" \
75 	"ip_dyn=yes\0" \
76 	"console=" CONSOLE_DEV "\0" \
77 	"dfuspi=dfu 0 sf 0:0:10000000:0\0" \
78 	"dfu_alt_info_spl=spl raw 0x400\0" \
79 	"dfu_alt_info_img=u-boot raw 0x10000\0" \
80 	"dfu_alt_info=spl raw 0x400\0" \
81 	"fdt_high=0xffffffff\0"	  \
82 	"initrd_high=0xffffffff\0" \
83 	"mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
84 	"mmcpart=1\0" \
85 	"mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
86 	"update_sd_firmware=" \
87 		"if test ${ip_dyn} = yes; then " \
88 			"setenv get_cmd dhcp; " \
89 		"else " \
90 			"setenv get_cmd tftp; " \
91 		"fi; " \
92 		"if mmc dev ${mmcdev}; then "	\
93 			"if ${get_cmd} ${update_sd_firmware_filename}; then " \
94 				"setexpr fw_sz ${filesize} / 0x200; " \
95 				"setexpr fw_sz ${fw_sz} + 1; "	\
96 				"mmc write ${loadaddr} 0x2 ${fw_sz}; " \
97 			"fi; "	\
98 		"fi\0" \
99 	EMMC_ENV	  \
100 	"mmcargs=setenv bootargs console=${console},${baudrate} " \
101 		"root=${mmcroot}\0" \
102 	"loadbootscript=" \
103 		"fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
104 	"bootscript=echo Running bootscript from mmc ...; " \
105 		"source\0" \
106 	"loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
107 	"loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
108 	"mmcboot=echo Booting from mmc ...; " \
109 		"run mmcargs; " \
110 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
111 			"if run loadfdt; then " \
112 				"bootz ${loadaddr} - ${fdt_addr}; " \
113 			"else " \
114 				"if test ${boot_fdt} = try; then " \
115 					"bootz; " \
116 				"else " \
117 					"echo WARN: Cannot load the DT; " \
118 				"fi; " \
119 			"fi; " \
120 		"else " \
121 			"bootz; " \
122 		"fi;\0" \
123 	"netargs=setenv bootargs console=${console},${baudrate} " \
124 		"root=/dev/nfs " \
125 		"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
126 	"netboot=echo Booting from net ...; " \
127 		"run netargs; " \
128 		"if test ${ip_dyn} = yes; then " \
129 			"setenv get_cmd dhcp; " \
130 		"else " \
131 			"setenv get_cmd tftp; " \
132 		"fi; " \
133 		"${get_cmd} ${image}; " \
134 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
135 			"if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
136 				"bootz ${loadaddr} - ${fdt_addr}; " \
137 			"else " \
138 				"if test ${boot_fdt} = try; then " \
139 					"bootz; " \
140 				"else " \
141 					"echo WARN: Cannot load the DT; " \
142 				"fi; " \
143 			"fi; " \
144 		"else " \
145 			"bootz; " \
146 		"fi;\0" \
147 		"findfdt="\
148 			"if test $fdt_file = undefined; then " \
149 				"if test $board_name = SABREAUTO && test $board_rev = MX6QP; then " \
150 					"setenv fdt_file imx6qp-sabreauto.dtb; fi; " \
151 				"if test $board_name = SABREAUTO && test $board_rev = MX6Q; then " \
152 					"setenv fdt_file imx6q-sabreauto.dtb; fi; " \
153 				"if test $board_name = SABREAUTO && test $board_rev = MX6DL; then " \
154 					"setenv fdt_file imx6dl-sabreauto.dtb; fi; " \
155 				"if test $board_name = SABRESD && test $board_rev = MX6QP; then " \
156 					"setenv fdt_file imx6qp-sabresd.dtb; fi; " \
157 				"if test $board_name = SABRESD && test $board_rev = MX6Q; then " \
158 					"setenv fdt_file imx6q-sabresd.dtb; fi; " \
159 				"if test $board_name = SABRESD && test $board_rev = MX6DL; then " \
160 					"setenv fdt_file imx6dl-sabresd.dtb; fi; " \
161 				"if test $fdt_file = undefined; then " \
162 					"echo WARNING: Could not determine dtb to use; fi; " \
163 			"fi;\0" \
164 
165 #define CONFIG_BOOTCOMMAND \
166 	"run findfdt;" \
167 	"mmc dev ${mmcdev};" \
168 	"if mmc rescan; then " \
169 		"if run loadbootscript; then " \
170 		"run bootscript; " \
171 		"else " \
172 			"if run loadimage; then " \
173 				"run mmcboot; " \
174 			"else run netboot; " \
175 			"fi; " \
176 		"fi; " \
177 	"else run netboot; fi"
178 
179 #define CONFIG_ARP_TIMEOUT     200UL
180 
181 #define CONFIG_SYS_MEMTEST_START       0x10000000
182 #define CONFIG_SYS_MEMTEST_END         0x10010000
183 #define CONFIG_SYS_MEMTEST_SCRATCH     0x10800000
184 
185 #define CONFIG_STACKSIZE               (128 * 1024)
186 
187 /* Physical Memory Map */
188 #define CONFIG_NR_DRAM_BANKS           1
189 #define PHYS_SDRAM                     MMDC0_ARB_BASE_ADDR
190 
191 #define CONFIG_SYS_SDRAM_BASE          PHYS_SDRAM
192 #define CONFIG_SYS_INIT_RAM_ADDR       IRAM_BASE_ADDR
193 #define CONFIG_SYS_INIT_RAM_SIZE       IRAM_SIZE
194 
195 #define CONFIG_SYS_INIT_SP_OFFSET \
196 	(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
197 #define CONFIG_SYS_INIT_SP_ADDR \
198 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
199 
200 /* Environment organization */
201 #define CONFIG_ENV_SIZE			(8 * 1024)
202 
203 #define CONFIG_ENV_IS_IN_MMC
204 
205 #if defined(CONFIG_ENV_IS_IN_MMC)
206 #define CONFIG_ENV_OFFSET		(768 * 1024)
207 #endif
208 
209 /* Framebuffer */
210 #define CONFIG_VIDEO_IPUV3
211 #define CONFIG_VIDEO_BMP_RLE8
212 #define CONFIG_SPLASH_SCREEN
213 #define CONFIG_SPLASH_SCREEN_ALIGN
214 #define CONFIG_BMP_16BPP
215 #define CONFIG_VIDEO_LOGO
216 #define CONFIG_VIDEO_BMP_LOGO
217 #ifdef CONFIG_MX6DL
218 #define CONFIG_IPUV3_CLK 198000000
219 #else
220 #define CONFIG_IPUV3_CLK 264000000
221 #endif
222 #define CONFIG_IMX_HDMI
223 #define CONFIG_IMX_VIDEO_SKIP
224 
225 #ifndef CONFIG_SPL
226 #define CONFIG_USBD_HS
227 
228 #define CONFIG_USB_FUNCTION_MASS_STORAGE
229 
230 #define CONFIG_USB_FUNCTION_FASTBOOT
231 #define CONFIG_CMD_FASTBOOT
232 #define CONFIG_ANDROID_BOOT_IMAGE
233 #define CONFIG_FASTBOOT_BUF_ADDR   CONFIG_SYS_LOAD_ADDR
234 #define CONFIG_FASTBOOT_BUF_SIZE   0x07000000
235 #endif
236 
237 #endif                         /* __MX6QSABRE_COMMON_CONFIG_H */
238