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 #define CONFIG_MX6
13 
14 #include "mx6_common.h"
15 #include <asm/sizes.h>
16 
17 #define CONFIG_DISPLAY_CPUINFO
18 #define CONFIG_DISPLAY_BOARDINFO
19 
20 #include <asm/arch/imx-regs.h>
21 #include <asm/imx-common/gpio.h>
22 
23 #define CONFIG_CMDLINE_TAG
24 #define CONFIG_SETUP_MEMORY_TAGS
25 #define CONFIG_INITRD_TAG
26 #define CONFIG_REVISION_TAG
27 
28 /* Size of malloc() pool */
29 #define CONFIG_SYS_MALLOC_LEN		(10 * SZ_1M)
30 
31 #define CONFIG_BOARD_EARLY_INIT_F
32 #define CONFIG_BOARD_LATE_INIT
33 #define CONFIG_MXC_GPIO
34 
35 #define CONFIG_MXC_UART
36 
37 #define CONFIG_CMD_FUSE
38 #ifdef CONFIG_CMD_FUSE
39 #define CONFIG_MXC_OCOTP
40 #endif
41 
42 /* MMC Configs */
43 #define CONFIG_FSL_ESDHC
44 #define CONFIG_FSL_USDHC
45 #define CONFIG_SYS_FSL_ESDHC_ADDR      0
46 
47 #define CONFIG_MMC
48 #define CONFIG_CMD_MMC
49 #define CONFIG_GENERIC_MMC
50 #define CONFIG_BOUNCE_BUFFER
51 #define CONFIG_CMD_EXT2
52 #define CONFIG_CMD_FAT
53 #define CONFIG_DOS_PARTITION
54 
55 #define CONFIG_CMD_PING
56 #define CONFIG_CMD_DHCP
57 #define CONFIG_CMD_MII
58 #define CONFIG_CMD_NET
59 #define CONFIG_FEC_MXC
60 #define CONFIG_MII
61 #define IMX_FEC_BASE			ENET_BASE_ADDR
62 #define CONFIG_FEC_XCV_TYPE		RGMII
63 #define CONFIG_ETHPRIME			"FEC"
64 #define CONFIG_FEC_MXC_PHYADDR		1
65 
66 #define CONFIG_PHYLIB
67 #define CONFIG_PHY_ATHEROS
68 
69 #define CONFIG_CMD_SF
70 #ifdef CONFIG_CMD_SF
71 #define CONFIG_SPI_FLASH
72 #define CONFIG_SPI_FLASH_STMICRO
73 #define CONFIG_MXC_SPI
74 #define CONFIG_SF_DEFAULT_BUS		0
75 #define CONFIG_SF_DEFAULT_CS		(0 | (IMX_GPIO_NR(4, 9) << 8))
76 #define CONFIG_SF_DEFAULT_SPEED		20000000
77 #define CONFIG_SF_DEFAULT_MODE		SPI_MODE_0
78 #endif
79 
80 /* allow to overwrite serial and ethaddr */
81 #define CONFIG_ENV_OVERWRITE
82 #define CONFIG_CONS_INDEX              1
83 #define CONFIG_BAUDRATE                        115200
84 
85 /* Command definition */
86 #include <config_cmd_default.h>
87 
88 #define CONFIG_CMD_BMODE
89 #define CONFIG_CMD_BOOTZ
90 #define CONFIG_CMD_SETEXPR
91 #undef CONFIG_CMD_IMLS
92 
93 #define CONFIG_BOOTDELAY               1
94 
95 #define CONFIG_LOADADDR                        0x12000000
96 #define CONFIG_SYS_TEXT_BASE           0x17800000
97 
98 #ifdef CONFIG_SUPPORT_EMMC_BOOT
99 #define EMMC_ENV \
100 	"emmcdev=2\0" \
101 	"update_emmc_firmware=" \
102 		"if test ${ip_dyn} = yes; then " \
103 			"setenv get_cmd dhcp; " \
104 		"else " \
105 			"setenv get_cmd tftp; " \
106 		"fi; " \
107 		"if ${get_cmd} ${update_sd_firmware_filename}; then " \
108 			"if mmc dev ${emmcdev} && " \
109 				"mmc open ${emmcdev} 1; then "	\
110 				"setexpr fw_sz ${filesize} / 0x200; " \
111 				"setexpr fw_sz ${fw_sz} + 1; "	\
112 				"mmc write ${loadaddr} 0x2 ${fw_sz}; " \
113 				"mmc close ${emmcdev} 1; " \
114 			"fi; "	\
115 		"fi\0"
116 #else
117 #define EMMC_ENV ""
118 #endif
119 
120 #define CONFIG_EXTRA_ENV_SETTINGS \
121 	"script=boot.scr\0" \
122 	"uimage=uImage\0" \
123 	"fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
124 	"fdt_addr=0x18000000\0" \
125 	"boot_fdt=try\0" \
126 	"ip_dyn=yes\0" \
127 	"console=" CONFIG_CONSOLE_DEV "\0" \
128 	"fdt_high=0xffffffff\0"	  \
129 	"initrd_high=0xffffffff\0" \
130 	"mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
131 	"mmcpart=1\0" \
132 	"mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
133 	"update_sd_firmware=" \
134 		"if test ${ip_dyn} = yes; then " \
135 			"setenv get_cmd dhcp; " \
136 		"else " \
137 			"setenv get_cmd tftp; " \
138 		"fi; " \
139 		"if mmc dev ${mmcdev}; then "	\
140 			"if ${get_cmd} ${update_sd_firmware_filename}; then " \
141 				"setexpr fw_sz ${filesize} / 0x200; " \
142 				"setexpr fw_sz ${fw_sz} + 1; "	\
143 				"mmc write ${loadaddr} 0x2 ${fw_sz}; " \
144 			"fi; "	\
145 		"fi\0" \
146 	EMMC_ENV	  \
147 	"mmcargs=setenv bootargs console=${console},${baudrate} " \
148 		"root=${mmcroot}\0" \
149 	"loadbootscript=" \
150 		"fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
151 	"bootscript=echo Running bootscript from mmc ...; " \
152 		"source\0" \
153 	"loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
154 	"loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
155 	"mmcboot=echo Booting from mmc ...; " \
156 		"run mmcargs; " \
157 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
158 			"if run loadfdt; then " \
159 				"bootm ${loadaddr} - ${fdt_addr}; " \
160 			"else " \
161 				"if test ${boot_fdt} = try; then " \
162 					"bootm; " \
163 				"else " \
164 					"echo WARN: Cannot load the DT; " \
165 				"fi; " \
166 			"fi; " \
167 		"else " \
168 			"bootm; " \
169 		"fi;\0" \
170 	"netargs=setenv bootargs console=${console},${baudrate} " \
171 		"root=/dev/nfs " \
172 		"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
173 	"netboot=echo Booting from net ...; " \
174 		"run netargs; " \
175 		"if test ${ip_dyn} = yes; then " \
176 			"setenv get_cmd dhcp; " \
177 		"else " \
178 			"setenv get_cmd tftp; " \
179 		"fi; " \
180 		"${get_cmd} ${uimage}; " \
181 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
182 			"if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
183 				"bootm ${loadaddr} - ${fdt_addr}; " \
184 			"else " \
185 				"if test ${boot_fdt} = try; then " \
186 					"bootm; " \
187 				"else " \
188 					"echo WARN: Cannot load the DT; " \
189 				"fi; " \
190 			"fi; " \
191 		"else " \
192 			"bootm; " \
193 		"fi;\0"
194 
195 #define CONFIG_BOOTCOMMAND \
196 	"mmc dev ${mmcdev};" \
197 	"if mmc rescan; then " \
198 		"if run loadbootscript; then " \
199 		"run bootscript; " \
200 		"else " \
201 			"if run loaduimage; then " \
202 				"run mmcboot; " \
203 			"else run netboot; " \
204 			"fi; " \
205 		"fi; " \
206 	"else run netboot; fi"
207 
208 #define CONFIG_ARP_TIMEOUT     200UL
209 
210 /* Miscellaneous configurable options */
211 #define CONFIG_SYS_LONGHELP
212 #define CONFIG_SYS_HUSH_PARSER
213 #define CONFIG_SYS_PROMPT_HUSH_PS2     "> "
214 #define CONFIG_AUTO_COMPLETE
215 #define CONFIG_SYS_CBSIZE              256
216 
217 /* Print Buffer Size */
218 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
219 #define CONFIG_SYS_MAXARGS             16
220 #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
221 
222 #define CONFIG_SYS_MEMTEST_START       0x10000000
223 #define CONFIG_SYS_MEMTEST_END         0x10010000
224 #define CONFIG_SYS_MEMTEST_SCRATCH     0x10800000
225 
226 #define CONFIG_SYS_LOAD_ADDR           CONFIG_LOADADDR
227 
228 #define CONFIG_CMDLINE_EDITING
229 #define CONFIG_STACKSIZE               (128 * 1024)
230 
231 /* Physical Memory Map */
232 #define CONFIG_NR_DRAM_BANKS           1
233 #define PHYS_SDRAM                     MMDC0_ARB_BASE_ADDR
234 
235 #define CONFIG_SYS_SDRAM_BASE          PHYS_SDRAM
236 #define CONFIG_SYS_INIT_RAM_ADDR       IRAM_BASE_ADDR
237 #define CONFIG_SYS_INIT_RAM_SIZE       IRAM_SIZE
238 
239 #define CONFIG_SYS_INIT_SP_OFFSET \
240 	(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
241 #define CONFIG_SYS_INIT_SP_ADDR \
242 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
243 
244 /* FLASH and environment organization */
245 #define CONFIG_SYS_NO_FLASH
246 
247 #define CONFIG_ENV_SIZE			(8 * 1024)
248 
249 #define CONFIG_ENV_IS_IN_MMC
250 
251 #if defined(CONFIG_ENV_IS_IN_MMC)
252 #define CONFIG_ENV_OFFSET		(6 * 64 * 1024)
253 #endif
254 
255 #define CONFIG_OF_LIBFDT
256 
257 #ifndef CONFIG_SYS_DCACHE_OFF
258 #define CONFIG_CMD_CACHE
259 #endif
260 
261 #endif                         /* __MX6QSABRE_COMMON_CONFIG_H */
262