1 /*
2  * Copyright (C) 2015 Freescale Semiconductor, Inc.
3  *
4  * Configuration settings for the Freescale i.MX7D SABRESD board.
5  *
6  * SPDX-License-Identifier:	GPL-2.0+
7  */
8 
9 #ifndef __MX7D_SABRESD_CONFIG_H
10 #define __MX7D_SABRESD_CONFIG_H
11 
12 #include "mx7_common.h"
13 
14 #define CONFIG_DBG_MONITOR
15 #define PHYS_SDRAM_SIZE			SZ_1G
16 
17 /* Uncomment to enable secure boot support */
18 /* #define CONFIG_SECURE_BOOT */
19 #define CONFIG_CSF_SIZE			0x4000
20 
21 /* Network */
22 #define CONFIG_CMD_MII
23 #define CONFIG_FEC_MXC
24 #define CONFIG_MII
25 #define CONFIG_FEC_XCV_TYPE             RGMII
26 #define CONFIG_ETHPRIME                 "FEC"
27 #define CONFIG_FEC_MXC_PHYADDR          0
28 
29 #define CONFIG_PHYLIB
30 #define CONFIG_PHY_BROADCOM
31 /* ENET1 */
32 #define IMX_FEC_BASE			ENET_IPS_BASE_ADDR
33 
34 /* MMC Config*/
35 #define CONFIG_SYS_FSL_ESDHC_ADDR       0
36 
37 /* PMIC */
38 #define CONFIG_POWER
39 #define CONFIG_POWER_I2C
40 #define CONFIG_POWER_PFUZE3000
41 #define CONFIG_POWER_PFUZE3000_I2C_ADDR	0x08
42 
43 #undef CONFIG_BOOTM_NETBSD
44 #undef CONFIG_BOOTM_PLAN9
45 #undef CONFIG_BOOTM_RTEMS
46 
47 #undef CONFIG_CMD_EXPORTENV
48 #undef CONFIG_CMD_IMPORTENV
49 
50 /* I2C configs */
51 #define CONFIG_CMD_I2C
52 #define CONFIG_SYS_I2C
53 #define CONFIG_SYS_I2C_MXC
54 #define CONFIG_SYS_I2C_MXC_I2C1		/* enable I2C bus 1 */
55 #define CONFIG_SYS_I2C_SPEED		100000
56 
57 #define CONFIG_SUPPORT_EMMC_BOOT	/* eMMC specific */
58 #define CONFIG_SYS_MMC_IMG_LOAD_PART	1
59 
60 #ifdef CONFIG_IMX_BOOTAUX
61 /* Set to QSPI1 A flash at default */
62 #define CONFIG_SYS_AUXCORE_BOOTDATA 0x60000000
63 #define CONFIG_CMD_SETEXPR
64 
65 #define UPDATE_M4_ENV \
66 	"m4image=m4_qspi.bin\0" \
67 	"loadm4image=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${m4image}\0" \
68 	"update_m4_from_sd=" \
69 		"if sf probe 0:0; then " \
70 			"if run loadm4image; then " \
71 				"setexpr fw_sz ${filesize} + 0xffff; " \
72 				"setexpr fw_sz ${fw_sz} / 0x10000; "	\
73 				"setexpr fw_sz ${fw_sz} * 0x10000; "	\
74 				"sf erase 0x0 ${fw_sz}; " \
75 				"sf write ${loadaddr} 0x0 ${filesize}; " \
76 			"fi; " \
77 		"fi\0" \
78 	"m4boot=sf probe 0:0; bootaux "__stringify(CONFIG_SYS_AUXCORE_BOOTDATA)"\0"
79 #else
80 #define UPDATE_M4_ENV ""
81 #endif
82 
83 #define CONFIG_MFG_ENV_SETTINGS \
84 	"mfgtool_args=setenv bootargs console=${console},${baudrate} " \
85 		"rdinit=/linuxrc " \
86 		"g_mass_storage.stall=0 g_mass_storage.removable=1 " \
87 		"g_mass_storage.idVendor=0x066F g_mass_storage.idProduct=0x37FF "\
88 		"g_mass_storage.iSerialNumber=\"\" "\
89 		"clk_ignore_unused "\
90 		"\0" \
91 	"initrd_addr=0x83800000\0" \
92 	"initrd_high=0xffffffff\0" \
93 	"bootcmd_mfg=run mfgtool_args;bootz ${loadaddr} ${initrd_addr} ${fdt_addr};\0" \
94 
95 #define CONFIG_DFU_ENV_SETTINGS \
96 	"dfu_alt_info=image raw 0 0x800000;"\
97 		"u-boot raw 0 0x4000;"\
98 		"bootimg part 0 1;"\
99 		"rootfs part 0 2\0" \
100 
101 #define CONFIG_EXTRA_ENV_SETTINGS \
102 	UPDATE_M4_ENV \
103 	CONFIG_MFG_ENV_SETTINGS \
104 	CONFIG_DFU_ENV_SETTINGS \
105 	"script=boot.scr\0" \
106 	"image=zImage\0" \
107 	"console=ttymxc0\0" \
108 	"fdt_high=0xffffffff\0" \
109 	"initrd_high=0xffffffff\0" \
110 	"fdt_file=imx7d-sdb.dtb\0" \
111 	"fdt_addr=0x83000000\0" \
112 	"boot_fdt=try\0" \
113 	"ip_dyn=yes\0" \
114 	"videomode=video=ctfb:x:480,y:272,depth:24,pclk:108695,le:8,ri:4,up:2,lo:4,hs:41,vs:10,sync:0,vmode:0\0" \
115 	"mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
116 	"mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
117 	"mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
118 	"mmcautodetect=yes\0" \
119 	"mmcargs=setenv bootargs console=${console},${baudrate} " \
120 		"root=${mmcroot}\0" \
121 	"loadbootscript=" \
122 		"fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
123 	"bootscript=echo Running bootscript from mmc ...; " \
124 		"source\0" \
125 	"loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
126 	"loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
127 	"mmcboot=echo Booting from mmc ...; " \
128 		"run mmcargs; " \
129 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
130 			"if run loadfdt; then " \
131 				"bootz ${loadaddr} - ${fdt_addr}; " \
132 			"else " \
133 				"if test ${boot_fdt} = try; then " \
134 					"bootz; " \
135 				"else " \
136 					"echo WARN: Cannot load the DT; " \
137 				"fi; " \
138 			"fi; " \
139 		"else " \
140 			"bootz; " \
141 		"fi;\0" \
142 	"netargs=setenv bootargs console=${console},${baudrate} " \
143 		"root=/dev/nfs " \
144 	"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
145 		"netboot=echo Booting from net ...; " \
146 		"run netargs; " \
147 		"if test ${ip_dyn} = yes; then " \
148 			"setenv get_cmd dhcp; " \
149 		"else " \
150 			"setenv get_cmd tftp; " \
151 		"fi; " \
152 		"${get_cmd} ${image}; " \
153 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
154 			"if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
155 				"bootz ${loadaddr} - ${fdt_addr}; " \
156 			"else " \
157 				"if test ${boot_fdt} = try; then " \
158 					"bootz; " \
159 				"else " \
160 					"echo WARN: Cannot load the DT; " \
161 				"fi; " \
162 			"fi; " \
163 		"else " \
164 			"bootz; " \
165 		"fi;\0"
166 
167 #define CONFIG_BOOTCOMMAND \
168 	   "mmc dev ${mmcdev};" \
169 	   "mmc dev ${mmcdev}; if mmc rescan; then " \
170 		   "if run loadbootscript; then " \
171 			   "run bootscript; " \
172 		   "else " \
173 			   "if run loadimage; then " \
174 				   "run mmcboot; " \
175 			   "else run netboot; " \
176 			   "fi; " \
177 		   "fi; " \
178 	   "else run netboot; fi"
179 
180 #define CONFIG_CMD_MEMTEST
181 #define CONFIG_SYS_MEMTEST_START	0x80000000
182 #define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_MEMTEST_START + 0x20000000)
183 
184 #define CONFIG_SYS_LOAD_ADDR		CONFIG_LOADADDR
185 #define CONFIG_SYS_HZ			1000
186 
187 #define CONFIG_STACKSIZE		SZ_128K
188 
189 /* Physical Memory Map */
190 #define CONFIG_NR_DRAM_BANKS		1
191 #define PHYS_SDRAM			MMDC0_ARB_BASE_ADDR
192 
193 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM
194 #define CONFIG_SYS_INIT_RAM_ADDR	IRAM_BASE_ADDR
195 #define CONFIG_SYS_INIT_RAM_SIZE	IRAM_SIZE
196 
197 #define CONFIG_SYS_INIT_SP_OFFSET \
198 	(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
199 #define CONFIG_SYS_INIT_SP_ADDR \
200 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
201 
202 /* FLASH and environment organization */
203 #define CONFIG_SYS_NO_FLASH
204 #define CONFIG_ENV_SIZE			SZ_8K
205 #define CONFIG_ENV_IS_IN_MMC
206 
207 /*
208  * If want to use nand, define CONFIG_NAND_MXS and rework board
209  * to support nand, since emmc has pin conflicts with nand
210  */
211 #ifdef CONFIG_NAND_MXS
212 #define CONFIG_CMD_NAND
213 #define CONFIG_CMD_NAND_TRIMFFS
214 
215 /* NAND stuff */
216 #define CONFIG_SYS_MAX_NAND_DEVICE	1
217 #define CONFIG_SYS_NAND_BASE		0x40000000
218 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
219 #define CONFIG_SYS_NAND_ONFI_DETECTION
220 
221 /* DMA stuff, needed for GPMI/MXS NAND support */
222 #define CONFIG_APBH_DMA
223 #define CONFIG_APBH_DMA_BURST
224 #define CONFIG_APBH_DMA_BURST8
225 #endif
226 
227 #define CONFIG_ENV_OFFSET		(8 * SZ_64K)
228 #ifdef CONFIG_NAND_MXS
229 #define CONFIG_SYS_FSL_USDHC_NUM	1
230 #else
231 #define CONFIG_SYS_FSL_USDHC_NUM	2
232 #endif
233 
234 #define CONFIG_SYS_MMC_ENV_DEV		0   /* USDHC1 */
235 #define CONFIG_SYS_MMC_ENV_PART		0	/* user area */
236 #define CONFIG_MMCROOT			"/dev/mmcblk0p2"  /* USDHC1 */
237 
238 /* USB Configs */
239 #define CONFIG_CMD_USB
240 #define CONFIG_USB_EHCI
241 #define CONFIG_USB_EHCI_MX7
242 #define CONFIG_USB_STORAGE
243 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
244 #define CONFIG_USB_HOST_ETHER
245 #define CONFIG_USB_ETHER_ASIX
246 #define CONFIG_MXC_USB_PORTSC  (PORT_PTS_UTMI | PORT_PTS_PTW)
247 #define CONFIG_MXC_USB_FLAGS   0
248 #define CONFIG_USB_MAX_CONTROLLER_COUNT 2
249 
250 #define CONFIG_IMX_THERMAL
251 
252 #define CONFIG_CI_UDC
253 #define CONFIG_USBD_HS
254 #define CONFIG_USB_GADGET_DUALSPEED
255 
256 #define CONFIG_CMD_USB_MASS_STORAGE
257 #define CONFIG_USB_FUNCTION_MASS_STORAGE
258 #define CONFIG_USB_GADGET_DOWNLOAD
259 #define CONFIG_USB_GADGET_VBUS_DRAW	2
260 
261 #define CONFIG_G_DNL_VENDOR_NUM		0x0525
262 #define CONFIG_G_DNL_PRODUCT_NUM	0xa4a5
263 #define CONFIG_G_DNL_MANUFACTURER	"FSL"
264 
265 /* USB Device Firmware Update support */
266 #define CONFIG_CMD_DFU
267 #define CONFIG_USB_FUNCTION_DFU
268 #define CONFIG_DFU_MMC
269 #define CONFIG_DFU_RAM
270 
271 #define CONFIG_VIDEO
272 #ifdef CONFIG_VIDEO
273 #define CONFIG_CFB_CONSOLE
274 #define CONFIG_VIDEO_MXS
275 #define CONFIG_VIDEO_LOGO
276 #define CONFIG_VIDEO_SW_CURSOR
277 #define CONFIG_VGA_AS_SINGLE_DEVICE
278 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
279 #define CONFIG_SPLASH_SCREEN
280 #define CONFIG_SPLASH_SCREEN_ALIGN
281 #define CONFIG_CMD_BMP
282 #define CONFIG_BMP_16BPP
283 #define CONFIG_VIDEO_BMP_RLE8
284 #define CONFIG_VIDEO_BMP_LOGO
285 #endif
286 
287 #ifdef CONFIG_FSL_QSPI
288 #define CONFIG_CMD_SF
289 #define CONFIG_SPI_FLASH
290 #define CONFIG_SPI_FLASH_MACRONIX
291 #define CONFIG_SPI_FLASH_BAR
292 #define CONFIG_SF_DEFAULT_BUS		0
293 #define CONFIG_SF_DEFAULT_CS		0
294 #define CONFIG_SF_DEFAULT_SPEED		40000000
295 #define CONFIG_SF_DEFAULT_MODE		SPI_MODE_0
296 #define FSL_QSPI_FLASH_NUM		1
297 #define FSL_QSPI_FLASH_SIZE		SZ_64M
298 #define QSPI0_BASE_ADDR			QSPI1_IPS_BASE_ADDR
299 #define QSPI0_AMBA_BASE			QSPI0_ARB_BASE_ADDR
300 #endif
301 
302 #endif	/* __CONFIG_H */
303