1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2013 Gateworks Corporation
4  */
5 
6 #ifndef __CONFIG_H
7 #define __CONFIG_H
8 
9 /* SPL */
10 /* Location in NAND to read U-Boot from */
11 #define CONFIG_SYS_NAND_U_BOOT_OFFS     (14 * SZ_1M)
12 
13 /* Falcon Mode */
14 #define CONFIG_SYS_SPL_ARGS_ADDR	0x18000000
15 
16 /* Falcon Mode - NAND support: args@17MB kernel@18MB */
17 #define CONFIG_SYS_NAND_SPL_KERNEL_OFFS	(18 * SZ_1M)
18 
19 /* Falcon Mode - MMC support: args@1MB kernel@2MB */
20 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR	0x800	/* 1MB */
21 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS	(CONFIG_CMD_SPL_WRITE_SIZE / 512)
22 #define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR	0x1000	/* 2MB */
23 
24 #include "imx6_spl.h"                  /* common IMX6 SPL configuration */
25 #include "mx6_common.h"
26 
27 #define CONFIG_MACH_TYPE	4520   /* Gateworks Ventana Platform */
28 
29 /* Serial ATAG */
30 #define CONFIG_SERIAL_TAG
31 
32 /* Size of malloc() pool */
33 #define CONFIG_SYS_MALLOC_LEN		(10 * SZ_1M)
34 
35 /* Serial */
36 #define CONFIG_MXC_UART_BASE	       UART2_BASE
37 
38 #if !defined(CONFIG_SPI_FLASH) && defined(CONFIG_SPL_NAND_SUPPORT)
39 /* Enable NAND support */
40 #ifdef CONFIG_CMD_NAND
41   #define CONFIG_SYS_MAX_NAND_DEVICE	1
42   #define CONFIG_SYS_NAND_BASE		0x40000000
43   #define CONFIG_SYS_NAND_5_ADDR_CYCLE
44   #define CONFIG_SYS_NAND_ONFI_DETECTION
45 
46   /* DMA stuff, needed for GPMI/MXS NAND support */
47 #endif
48 
49 #endif /* CONFIG_SPI_FLASH */
50 
51 /* I2C Configs */
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_MXC_I2C2		/* enable I2C bus 2 */
56 #define CONFIG_SYS_I2C_MXC_I2C3		/* enable I2C bus 3 */
57 #define CONFIG_SYS_I2C_SPEED		100000
58 #define CONFIG_I2C_GSC			0
59 #define CONFIG_I2C_EDID
60 
61 /* MMC Configs */
62 #define CONFIG_SYS_FSL_ESDHC_ADDR      0
63 
64 /*
65  * SATA Configs
66  */
67 #ifdef CONFIG_CMD_SATA
68   #define CONFIG_SYS_SATA_MAX_DEVICE	1
69   #define CONFIG_DWC_AHSATA_PORT_ID	0
70   #define CONFIG_DWC_AHSATA_BASE_ADDR	SATA_ARB_BASE_ADDR
71   #define CONFIG_LBA48
72 #endif
73 
74 /*
75  * PCI express
76  */
77 #ifdef CONFIG_CMD_PCI
78 #define CONFIG_PCI_SCAN_SHOW
79 #define CONFIG_PCI_FIXUP_DEV
80 #define CONFIG_PCIE_IMX
81 #endif
82 
83 /*
84  * PMIC
85  */
86 #define CONFIG_POWER
87 #define CONFIG_POWER_I2C
88 #define CONFIG_POWER_PFUZE100
89 #define CONFIG_POWER_PFUZE100_I2C_ADDR	0x08
90 #define CONFIG_POWER_LTC3676
91 #define CONFIG_POWER_LTC3676_I2C_ADDR  0x3c
92 
93 /* Various command support */
94 
95 /* Ethernet support */
96 #define CONFIG_FEC_MXC
97 #define IMX_FEC_BASE             ENET_BASE_ADDR
98 #define CONFIG_FEC_XCV_TYPE      RGMII
99 #define CONFIG_FEC_MXC_PHYADDR   0
100 #define CONFIG_ARP_TIMEOUT       200UL
101 
102 /* USB Configs */
103 #define CONFIG_USB_MAX_CONTROLLER_COUNT 2
104 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET  /* For OTG port */
105 #define CONFIG_MXC_USB_PORTSC     (PORT_PTS_UTMI | PORT_PTS_PTW)
106 #define CONFIG_MXC_USB_FLAGS      0
107 #define CONFIG_USBD_HS
108 
109 /* Framebuffer and LCD */
110 #define CONFIG_VIDEO_LOGO
111 #define CONFIG_IMX_HDMI
112 #define CONFIG_IMX_VIDEO_SKIP
113 #define CONFIG_VIDEO_BMP_LOGO
114 #define CONFIG_HIDE_LOGO_VERSION  /* Custom config to hide U-boot version */
115 
116 /* Miscellaneous configurable options */
117 #define CONFIG_HWCONFIG
118 
119 /* Memory configuration */
120 
121 /* Physical Memory Map */
122 #define PHYS_SDRAM                     MMDC0_ARB_BASE_ADDR
123 #define CONFIG_SYS_SDRAM_BASE          PHYS_SDRAM
124 #define CONFIG_SYS_INIT_RAM_ADDR       IRAM_BASE_ADDR
125 #define CONFIG_SYS_INIT_RAM_SIZE       IRAM_SIZE
126 
127 #define CONFIG_SYS_INIT_SP_OFFSET \
128 	(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
129 #define CONFIG_SYS_INIT_SP_ADDR \
130 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
131 
132 /*
133  * MTD Command for mtdparts
134  */
135 
136 /* Persistent Environment Config */
137 
138 /* Environment */
139 #define CONFIG_IPADDR             192.168.1.1
140 #define CONFIG_SERVERIP           192.168.1.146
141 
142 #define CONFIG_EXTRA_ENV_SETTINGS_COMMON \
143 	"pcidisable=1\0" \
144 	"splashpos=m,m\0" \
145 	"usb_pgood_delay=2000\0" \
146 	"console=ttymxc1\0" \
147 	"bootdevs=usb mmc sata flash\0" \
148 	"hwconfig=_UNKNOWN_\0" \
149 	"video=\0" \
150 	\
151 	"mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
152 	"mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \
153 	"disk=0\0" \
154 	"part=1\0" \
155 	\
156 	"fdt_high=0xffffffff\0" \
157 	"fdt_addr=0x18000000\0" \
158 	"initrd_high=0xffffffff\0" \
159 	"fixfdt=" \
160 		"fdt addr ${fdt_addr}\0" \
161 	"bootdir=boot\0" \
162 	"loadfdt=" \
163 		"if ${fsload} ${fdt_addr} ${bootdir}/${fdt_file}; then " \
164 			"echo Loaded DTB from ${bootdir}/${fdt_file}; " \
165 			"run fixfdt; " \
166 		"elif ${fsload} ${fdt_addr} ${bootdir}/${fdt_file1}; then " \
167 			"echo Loaded DTB from ${bootdir}/${fdt_file1}; " \
168 			"run fixfdt; " \
169 		"elif ${fsload} ${fdt_addr} ${bootdir}/${fdt_file2}; then " \
170 			"echo Loaded DTB from ${bootdir}/${fdt_file2}; " \
171 			"run fixfdt; " \
172 		"fi\0" \
173 	\
174 	"fs=ext4\0" \
175 	"script=6x_bootscript-ventana\0" \
176 	"loadscript=" \
177 		"if ${fsload} ${loadaddr} ${bootdir}/${script}; then " \
178 			"source ${loadaddr}; " \
179 		"fi\0" \
180 	\
181 	"uimage=uImage\0" \
182 	"mmc_root=mmcblk0p1\0" \
183 	"mmc_boot=" \
184 		"setenv fsload \"${fs}load mmc ${disk}:${part}\"; " \
185 		"mmc dev ${disk} && mmc rescan && " \
186 		"setenv dtype mmc; run loadscript; " \
187 		"if ${fsload} ${loadaddr} ${bootdir}/${uimage}; then " \
188 			"setenv bootargs console=${console},${baudrate} " \
189 				"root=/dev/${mmc_root} rootfstype=${fs} " \
190 				"rootwait rw ${video} ${extra}; " \
191 			"if run loadfdt; then " \
192 				"bootm ${loadaddr} - ${fdt_addr}; " \
193 			"else " \
194 				"bootm; " \
195 			"fi; " \
196 		"fi\0" \
197 	\
198 	"sata_boot=" \
199 		"setenv fsload \"${fs}load sata ${disk}:${part}\"; " \
200 		"sata init && " \
201 		"setenv dtype sata; run loadscript; " \
202 		"if ${fsload} ${loadaddr} ${bootdir}/${uimage}; then " \
203 			"setenv bootargs console=${console},${baudrate} " \
204 				"root=/dev/sda1 rootfstype=${fs} " \
205 				"rootwait rw ${video} ${extra}; " \
206 			"if run loadfdt; then " \
207 				"bootm ${loadaddr} - ${fdt_addr}; " \
208 			"else " \
209 				"bootm; " \
210 			"fi; " \
211 		"fi\0" \
212 	"usb_boot=" \
213 		"setenv fsload \"${fs}load usb ${disk}:${part}\"; " \
214 		"usb start && usb dev ${disk} && " \
215 		"setenv dtype usb; run loadscript; " \
216 		"if ${fsload} ${loadaddr} ${bootdir}/${uimage}; then " \
217 			"setenv bootargs console=${console},${baudrate} " \
218 				"root=/dev/sda1 rootfstype=${fs} " \
219 				"rootwait rw ${video} ${extra}; " \
220 			"if run loadfdt; then " \
221 				"bootm ${loadaddr} - ${fdt_addr}; " \
222 			"else " \
223 				"bootm; " \
224 			"fi; " \
225 		"fi\0"
226 
227 #ifdef CONFIG_SPI_FLASH
228 	#define CONFIG_EXTRA_ENV_SETTINGS \
229 	CONFIG_EXTRA_ENV_SETTINGS_COMMON \
230 	"image_os=ventana/openwrt-imx6-imx6q-gw5400-a-squashfs.bin\0" \
231 	"image_uboot=ventana/u-boot_spi.imx\0" \
232 	\
233 	"spi_koffset=0x90000\0" \
234 	"spi_klen=0x200000\0" \
235 	\
236 	"spi_updateuboot=echo Updating uboot from " \
237 		"${serverip}:${image_uboot}...; " \
238 		"tftpboot ${loadaddr} ${image_uboot} && " \
239 		"sf probe && sf erase 0 80000 && " \
240 			"sf write ${loadaddr} 400 ${filesize}\0" \
241 	"spi_update=echo Updating OS from ${serverip}:${image_os} " \
242 		"to ${spi_koffset} ...; " \
243 		"tftp ${loadaddr} ${image_os} && " \
244 		"sf probe && " \
245 		"sf update ${loadaddr} ${spi_koffset} ${filesize}\0" \
246 	\
247 	"flash_boot=" \
248 		"if sf probe && " \
249 		"sf read ${loadaddr} ${spi_koffset} ${spi_klen}; then " \
250 			"setenv bootargs console=${console},${baudrate} " \
251 				"root=/dev/mtdblock3 " \
252 				"rootfstype=squashfs,jffs2 " \
253 				"${video} ${extra}; " \
254 			"bootm; " \
255 		"fi\0"
256 #else
257 	#define CONFIG_EXTRA_ENV_SETTINGS \
258 	CONFIG_EXTRA_ENV_SETTINGS_COMMON \
259 	\
260 	"image_rootfs=openwrt-imx6-ventana-rootfs.ubi\0" \
261 	"nand_update=echo Updating NAND from ${serverip}:${image_rootfs}...; " \
262 		"tftp ${loadaddr} ${image_rootfs} && " \
263 		"nand erase.part rootfs && " \
264 		"nand write ${loadaddr} rootfs ${filesize}\0" \
265 	\
266 	"flash_boot=" \
267 		"setenv fsload 'ubifsload'; " \
268 		"ubi part rootfs; " \
269 		"if ubi check boot; then " \
270 			"ubifsmount ubi0:boot; " \
271 			"setenv root ubi0:rootfs ubi.mtd=2 " \
272 				"rootfstype=squashfs,ubifs; " \
273 			"setenv bootdir; " \
274 		"elif ubi check rootfs; then " \
275 			"ubifsmount ubi0:rootfs; " \
276 			"setenv root ubi0:rootfs ubi.mtd=2 " \
277 				"rootfstype=ubifs; " \
278 		"fi; " \
279 		"setenv dtype nand; run loadscript; " \
280 		"if ${fsload} ${loadaddr} ${bootdir}/${uimage}; then " \
281 			"setenv bootargs console=${console},${baudrate} " \
282 				"root=${root} ${video} ${extra}; " \
283 			"if run loadfdt; then " \
284 				"ubifsumount; " \
285 				"bootm ${loadaddr} - ${fdt_addr}; " \
286 			"else " \
287 				"ubifsumount; bootm; " \
288 			"fi; " \
289 		"fi\0"
290 #endif
291 
292 #define CONFIG_BOOTCOMMAND \
293 	"for btype in ${bootdevs}; do " \
294 		"echo; echo Attempting ${btype} boot...; " \
295 		"if run ${btype}_boot; then; fi; " \
296 	"done"
297 
298 #endif			       /* __CONFIG_H */
299