xref: /openbmc/u-boot/include/configs/gw_ventana.h (revision 60570df1)
1 /*
2  * Copyright (C) 2013 Gateworks Corporation
3  *
4  * SPDX-License-Identifier: GPL-2.0+
5  */
6 
7 #ifndef __CONFIG_H
8 #define __CONFIG_H
9 
10 /* SPL */
11 #define CONFIG_SPL_NAND_SUPPORT
12 #define CONFIG_SPL_MMC_SUPPORT
13 #define CONFIG_SPL_FAT_SUPPORT
14 /*
15 #define CONFIG_SPL_SATA_SUPPORT
16 */
17 /* Location in NAND to read U-Boot from */
18 #define CONFIG_SYS_NAND_U_BOOT_OFFS     (14 * 1024 * 1024)
19 
20 #include "imx6_spl.h"                  /* common IMX6 SPL configuration */
21 #include "mx6_common.h"
22 #define CONFIG_MX6
23 #define CONFIG_DISPLAY_CPUINFO         /* display cpu info */
24 #define CONFIG_DISPLAY_BOARDINFO_LATE  /* display board info (after reloc) */
25 
26 #define CONFIG_MACH_TYPE	4520   /* Gateworks Ventana Platform */
27 
28 #include <asm/arch/imx-regs.h>
29 #include <asm/imx-common/gpio.h>
30 
31 /* ATAGs */
32 #define CONFIG_CMDLINE_TAG
33 #define CONFIG_SETUP_MEMORY_TAGS
34 #define CONFIG_INITRD_TAG
35 #define CONFIG_SERIAL_TAG
36 #define CONFIG_REVISION_TAG
37 
38 #define CONFIG_SYS_GENERIC_BOARD
39 
40 /* Size of malloc() pool */
41 #define CONFIG_SYS_MALLOC_LEN		(10 * 1024 * 1024)
42 
43 /* Init Functions */
44 #define CONFIG_BOARD_EARLY_INIT_F
45 #define CONFIG_MISC_INIT_R
46 
47 /* GPIO */
48 #define CONFIG_MXC_GPIO
49 
50 /* Serial */
51 #define CONFIG_MXC_UART
52 #define CONFIG_MXC_UART_BASE	       UART2_BASE
53 
54 #ifdef CONFIG_SPI_FLASH
55 
56 /* SPI */
57 #define CONFIG_CMD_SF
58 #ifdef CONFIG_CMD_SF
59   #define CONFIG_MXC_SPI
60   #define CONFIG_SPI_FLASH_MTD
61   #define CONFIG_SPI_FLASH_BAR
62   #define CONFIG_SPI_FLASH_WINBOND
63   #define CONFIG_SF_DEFAULT_BUS              0
64   #define CONFIG_SF_DEFAULT_CS               0
65 					     /* GPIO 3-19 (21248) */
66   #define CONFIG_SF_DEFAULT_SPEED            30000000
67   #define CONFIG_SF_DEFAULT_MODE             (SPI_MODE_0)
68 #endif
69 
70 #else
71 /* Enable NAND support */
72 #define CONFIG_CMD_TIME
73 #define CONFIG_CMD_NAND
74 #define CONFIG_CMD_NAND_TRIMFFS
75 #ifdef CONFIG_CMD_NAND
76   #define CONFIG_NAND_MXS
77   #define CONFIG_SYS_MAX_NAND_DEVICE	1
78   #define CONFIG_SYS_NAND_BASE		0x40000000
79   #define CONFIG_SYS_NAND_5_ADDR_CYCLE
80   #define CONFIG_SYS_NAND_ONFI_DETECTION
81 
82   /* DMA stuff, needed for GPMI/MXS NAND support */
83   #define CONFIG_APBH_DMA
84   #define CONFIG_APBH_DMA_BURST
85   #define CONFIG_APBH_DMA_BURST8
86 #endif
87 
88 #endif /* CONFIG_SPI_FLASH */
89 
90 /* Flattened Image Tree Suport */
91 #define CONFIG_FIT
92 #define CONFIG_FIT_VERBOSE
93 
94 /* I2C Configs */
95 #define CONFIG_CMD_I2C
96 #define CONFIG_SYS_I2C
97 #define CONFIG_SYS_I2C_MXC
98 #define CONFIG_SYS_I2C_MXC_I2C3		/* enable I2C bus 3 */
99 #define CONFIG_SYS_I2C_SPEED		100000
100 #define CONFIG_I2C_GSC			0
101 #define CONFIG_I2C_PMIC			1
102 #define CONFIG_I2C_EDID
103 
104 /* MMC Configs */
105 #define CONFIG_FSL_ESDHC
106 #define CONFIG_FSL_USDHC
107 #define CONFIG_SYS_FSL_ESDHC_ADDR      0
108 #define CONFIG_SYS_FSL_USDHC_NUM       1
109 #define CONFIG_MMC
110 #define CONFIG_CMD_MMC
111 #define CONFIG_GENERIC_MMC
112 #define CONFIG_BOUNCE_BUFFER
113 
114 /* Filesystem support */
115 #define CONFIG_CMD_EXT2
116 #define CONFIG_CMD_EXT4
117 #define CONFIG_CMD_EXT4_WRITE
118 #define CONFIG_CMD_FAT
119 #define CONFIG_CMD_UBIFS
120 #define CONFIG_DOS_PARTITION
121 
122 /*
123  * SATA Configs
124  */
125 #define CONFIG_CMD_SATA
126 #ifdef CONFIG_CMD_SATA
127   #define CONFIG_DWC_AHSATA
128   #define CONFIG_SYS_SATA_MAX_DEVICE	1
129   #define CONFIG_DWC_AHSATA_PORT_ID	0
130   #define CONFIG_DWC_AHSATA_BASE_ADDR	SATA_ARB_BASE_ADDR
131   #define CONFIG_LBA48
132   #define CONFIG_LIBATA
133 #endif
134 
135 /*
136  * PCI express
137  */
138 #define CONFIG_CMD_PCI
139 #ifdef CONFIG_CMD_PCI
140 #define CONFIG_PCI
141 #define CONFIG_PCI_PNP
142 #define CONFIG_PCI_SCAN_SHOW
143 #define CONFIG_PCI_FIXUP_DEV
144 #define CONFIG_PCIE_IMX
145 #endif
146 
147 /*
148  * PMIC
149  */
150 #define CONFIG_POWER
151 #define CONFIG_POWER_I2C
152 #define CONFIG_POWER_PFUZE100
153 #define CONFIG_POWER_PFUZE100_I2C_ADDR	0x08
154 #define CONFIG_POWER_LTC3676
155 #define CONFIG_POWER_LTC3676_I2C_ADDR  0x3c
156 
157 /* Various command support */
158 #include <config_cmd_default.h>
159 #undef CONFIG_CMD_IMLS
160 #define CONFIG_CMD_PING
161 #define CONFIG_CMD_DHCP
162 #define CONFIG_CMD_MII
163 #define CONFIG_CMD_NET
164 #define CONFIG_CMD_BMODE         /* set eFUSE shadow for a boot dev and reset */
165 #define CONFIG_CMD_HDMIDETECT    /* detect HDMI output device */
166 #define CONFIG_CMD_SETEXPR
167 #define CONFIG_CMD_BOOTZ
168 #define CONFIG_CMD_GSC
169 #define CONFIG_CMD_EECONFIG      /* Gateworks EEPROM config cmd */
170 #define CONFIG_CMD_UBI
171 #define CONFIG_RBTREE
172 #define CONFIG_LZO
173 #define CONFIG_CMD_FUSE          /* eFUSE read/write support */
174 #ifdef CONFIG_CMD_FUSE
175 #define CONFIG_MXC_OCOTP
176 #endif
177 
178 
179 /* Ethernet support */
180 #define CONFIG_FEC_MXC
181 #define CONFIG_E1000
182 #define CONFIG_MII
183 #define IMX_FEC_BASE             ENET_BASE_ADDR
184 #define CONFIG_FEC_XCV_TYPE      RGMII
185 #define CONFIG_FEC_MXC_PHYADDR   0
186 #define CONFIG_PHYLIB
187 #define CONFIG_ARP_TIMEOUT       200UL
188 
189 /* USB Configs */
190 #define CONFIG_CMD_USB
191 #define CONFIG_USB_EHCI
192 #define CONFIG_USB_EHCI_MX6
193 #define CONFIG_USB_STORAGE
194 #define CONFIG_USB_HOST_ETHER
195 #define CONFIG_USB_ETHER_ASIX
196 #define CONFIG_USB_ETHER_SMSC95XX
197 #define CONFIG_USB_MAX_CONTROLLER_COUNT 2
198 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET  /* For OTG port */
199 #define CONFIG_MXC_USB_PORTSC     (PORT_PTS_UTMI | PORT_PTS_PTW)
200 #define CONFIG_MXC_USB_FLAGS      0
201 #define CONFIG_USB_KEYBOARD
202 #define CONFIG_CI_UDC
203 #define CONFIG_USBD_HS
204 #define CONFIG_USB_GADGET_DUALSPEED
205 #define CONFIG_USB_ETHER
206 #define CONFIG_USB_ETH_CDC
207 #define CONFIG_NETCONSOLE
208 #define CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP
209 
210 /* USB Mass Storage Gadget */
211 #define CONFIG_USB_GADGET
212 #define CONFIG_CMD_USB_MASS_STORAGE
213 #define CONFIG_USB_GADGET_MASS_STORAGE
214 #define CONFIG_USBDOWNLOAD_GADGET
215 #define CONFIG_USB_GADGET_VBUS_DRAW    2
216 
217 /* Netchip IDs */
218 #define CONFIG_G_DNL_VENDOR_NUM 0x0525
219 #define CONFIG_G_DNL_PRODUCT_NUM 0xa4a5
220 #define CONFIG_G_DNL_MANUFACTURER "Gateworks"
221 
222 /* Framebuffer and LCD */
223 #define CONFIG_VIDEO
224 #define CONFIG_VIDEO_IPUV3
225 #define CONFIG_CFB_CONSOLE
226 #define CONFIG_VGA_AS_SINGLE_DEVICE
227 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
228 #define CONFIG_VIDEO_BMP_RLE8
229 #define CONFIG_SPLASH_SCREEN
230 #define CONFIG_BMP_16BPP
231 #define CONFIG_VIDEO_LOGO
232 #define CONFIG_IPUV3_CLK          260000000
233 #define CONFIG_CMD_HDMIDETECT
234 #define CONFIG_CONSOLE_MUX
235 #define CONFIG_IMX_HDMI
236 #define CONFIG_IMX_VIDEO_SKIP
237 
238 /* serial console (ttymxc1,115200) */
239 #define CONFIG_CONS_INDEX              1
240 #define CONFIG_BAUDRATE                115200
241 
242 /* Miscellaneous configurable options */
243 #define CONFIG_SYS_LONGHELP
244 #define CONFIG_SYS_HUSH_PARSER
245 #define CONFIG_SYS_PROMPT	             "Ventana > "
246 #define CONFIG_SYS_CBSIZE	             1024
247 #define CONFIG_AUTO_COMPLETE
248 #define CONFIG_CMDLINE_EDITING
249 #define CONFIG_HWCONFIG
250 
251 /* Print Buffer Size */
252 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
253 #define CONFIG_SYS_MAXARGS	           16
254 #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
255 
256 /* Memory configuration */
257 #define CONFIG_SYS_MEMTEST_START       0x10000000
258 #define CONFIG_SYS_MEMTEST_END	       0x10010000
259 #define CONFIG_SYS_MEMTEST_SCRATCH     0x10800000
260 #define CONFIG_SYS_TEXT_BASE	         0x17800000
261 #define CONFIG_SYS_LOAD_ADDR           0x12000000
262 
263 /* Physical Memory Map */
264 #define CONFIG_NR_DRAM_BANKS           1
265 #define PHYS_SDRAM                     MMDC0_ARB_BASE_ADDR
266 #define CONFIG_SYS_SDRAM_BASE          PHYS_SDRAM
267 #define CONFIG_SYS_INIT_RAM_ADDR       IRAM_BASE_ADDR
268 #define CONFIG_SYS_INIT_RAM_SIZE       IRAM_SIZE
269 
270 #define CONFIG_SYS_INIT_SP_OFFSET \
271 	(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
272 #define CONFIG_SYS_INIT_SP_ADDR \
273 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
274 
275 /* FLASH and environment organization */
276 #define CONFIG_SYS_NO_FLASH  /* no NOR flash */
277 
278 /*
279  * MTD Command for mtdparts
280  */
281 #define CONFIG_CMD_MTDPARTS
282 #define CONFIG_MTD_DEVICE
283 #define CONFIG_MTD_PARTITIONS
284 #ifdef CONFIG_SPI_FLASH
285 #define MTDIDS_DEFAULT    "nor0=nor"
286 #define MTDPARTS_DEFAULT  \
287 	"mtdparts=nor:512k(uboot),64k(env),2m(kernel),-(rootfs)"
288 #else
289 #define MTDIDS_DEFAULT    "nand0=nand"
290 #define MTDPARTS_DEFAULT  "mtdparts=nand:16m(uboot),1m(env),-(rootfs)"
291 #endif
292 
293 /* Persistent Environment Config */
294 #define CONFIG_ENV_OVERWRITE    /* allow to overwrite serial and ethaddr */
295 #ifdef CONFIG_SPI_FLASH
296 #define CONFIG_ENV_IS_IN_SPI_FLASH
297 #else
298 #define CONFIG_ENV_IS_IN_NAND
299 #endif
300 #if defined(CONFIG_ENV_IS_IN_MMC)
301   #define CONFIG_ENV_OFFSET              (6 * 64 * 1024)
302   #define CONFIG_ENV_SIZE                (8 * 1024)
303   #define CONFIG_SYS_MMC_ENV_DEV         0
304 #elif defined(CONFIG_ENV_IS_IN_NAND)
305   #define CONFIG_ENV_OFFSET              (16 << 20)
306   #define CONFIG_ENV_SECT_SIZE           (128 << 10)
307   #define CONFIG_ENV_SIZE                CONFIG_ENV_SECT_SIZE
308   #define CONFIG_ENV_OFFSET_REDUND       (CONFIG_ENV_OFFSET + (512 << 10))
309   #define CONFIG_ENV_SIZE_REDUND         CONFIG_ENV_SIZE
310 #elif defined(CONFIG_ENV_IS_IN_SPI_FLASH)
311   #define CONFIG_ENV_OFFSET              (512 * 1024)
312   #define CONFIG_ENV_SECT_SIZE           (64 * 1024)
313   #define CONFIG_ENV_SIZE                (8 * 1024)
314   #define CONFIG_ENV_SPI_BUS             CONFIG_SF_DEFAULT_BUS
315   #define CONFIG_ENV_SPI_CS              CONFIG_SF_DEFAULT_CS
316   #define CONFIG_ENV_SPI_MODE            CONFIG_SF_DEFAULT_MODE
317   #define CONFIG_ENV_SPI_MAX_HZ          CONFIG_SF_DEFAULT_SPEED
318 #endif
319 
320 /* Environment */
321 #define CONFIG_BOOTDELAY          3
322 #define CONFIG_LOADADDR           CONFIG_SYS_LOAD_ADDR
323 #define CONFIG_IPADDR             192.168.1.1
324 #define CONFIG_SERVERIP           192.168.1.146
325 #define HWCONFIG_DEFAULT \
326 	"hwconfig=rs232;" \
327 	"dio0:mode=gpio;dio1:mode=gpio;dio2:mode=gpio;dio3:mode=gpio\0" \
328 
329 #define CONFIG_EXTRA_ENV_SETTINGS_COMMON \
330 	"usb_pgood_delay=2000\0" \
331 	"console=ttymxc1\0" \
332 	"bootdevs=usb mmc sata flash\0" \
333 	HWCONFIG_DEFAULT \
334 	"video=\0" \
335 	\
336 	"mtdparts=" MTDPARTS_DEFAULT "\0" \
337 	"mtdids=" MTDIDS_DEFAULT "\0" \
338 	\
339 	"fdt_high=0xffffffff\0" \
340 	"fdt_addr=0x18000000\0" \
341 	"initrd_high=0xffffffff\0" \
342 	"bootdir=boot\0" \
343 	"loadfdt=" \
344 		"if ${fsload} ${fdt_addr} ${bootdir}/${fdt_file}; then " \
345 			"echo Loaded DTB from ${bootdir}/${fdt_file}; " \
346 		"elif ${fsload} ${fdt_addr} ${bootdir}/${fdt_file1}; then " \
347 			"echo Loaded DTB from ${bootdir}/${fdt_file1}; " \
348 		"elif ${fsload} ${fdt_addr} ${bootdir}/${fdt_file2}; then " \
349 			"echo Loaded DTB from ${bootdir}/${fdt_file2}; " \
350 		"fi\0" \
351 	\
352 	"script=6x_bootscript-ventana\0" \
353 	"loadscript=" \
354 		"if ${fsload} ${loadaddr} ${bootdir}/${script}; then " \
355 			"source; " \
356 		"fi\0" \
357 	\
358 	"uimage=uImage\0" \
359 	"mmc_root=/dev/mmcblk0p1 rootfstype=ext4 rootwait rw\0" \
360 	"mmc_boot=" \
361 		"setenv fsload 'ext2load mmc 0:1'; " \
362 		"mmc dev 0 && mmc rescan && " \
363 		"run loadscript; " \
364 		"if ${fsload} ${loadaddr} ${bootdir}/${uimage}; then " \
365 			"setenv bootargs console=${console},${baudrate} " \
366 				"root=/dev/mmcblk0p1 rootfstype=ext4 " \
367 				"rootwait rw ${video} ${extra}; " \
368 			"if run loadfdt && fdt addr ${fdt_addr}; then " \
369 				"bootm ${loadaddr} - ${fdt_addr}; " \
370 			"else " \
371 				"bootm; " \
372 			"fi; " \
373 		"fi\0" \
374 	\
375 	"sata_boot=" \
376 		"setenv fsload 'ext2load sata 0:1'; sata init && " \
377 		"run loadscript; " \
378 		"if ${fsload} ${loadaddr} ${bootdir}/${uimage}; then " \
379 			"setenv bootargs console=${console},${baudrate} " \
380 				"root=/dev/sda1 rootfstype=ext4 " \
381 				"rootwait rw ${video} ${extra}; " \
382 			"if run loadfdt && fdt addr ${fdt_addr}; then " \
383 				"bootm ${loadaddr} - ${fdt_addr}; " \
384 			"else " \
385 				"bootm; " \
386 			"fi; " \
387 		"fi\0" \
388 	"usb_boot=" \
389 		"setenv fsload 'ext2load usb 0:1'; usb start && usb dev 0 && " \
390 		"run loadscript; " \
391 		"if ${fsload} ${loadaddr} ${bootdir}/${uimage}; then " \
392 			"setenv bootargs console=${console},${baudrate} " \
393 				"root=/dev/sda1 rootfstype=ext4 " \
394 				"rootwait rw ${video} ${extra}; " \
395 			"if run loadfdt && fdt addr ${fdt_addr}; then " \
396 				"bootm ${loadaddr} - ${fdt_addr}; " \
397 			"else " \
398 				"bootm; " \
399 			"fi; " \
400 		"fi\0"
401 
402 #ifdef CONFIG_SPI_FLASH
403 	#define CONFIG_EXTRA_ENV_SETTINGS \
404 	CONFIG_EXTRA_ENV_SETTINGS_COMMON \
405 	"image_os=ventana/openwrt-imx6-imx6q-gw5400-a-squashfs.bin\0" \
406 	"image_uboot=ventana/u-boot_spi.imx\0" \
407 	\
408 	"spi_koffset=0x90000\0" \
409 	"spi_klen=0x200000\0" \
410 	\
411 	"spi_updateuboot=echo Updating uboot from " \
412 		"${serverip}:${image_uboot}...; " \
413 		"tftpboot ${loadaddr} ${image_uboot} && " \
414 		"sf probe && sf erase 0 80000 && " \
415 			"sf write ${loadaddr} 400 ${filesize}\0" \
416 	"spi_update=echo Updating OS from ${serverip}:${image_os} " \
417 		"to ${spi_koffset} ...; " \
418 		"tftp ${loadaddr} ${image_os} && " \
419 		"sf probe && " \
420 		"sf update ${loadaddr} ${spi_koffset} ${filesize}\0" \
421 	\
422 	"flash_boot=" \
423 		"if sf probe && " \
424 		"sf read ${loadaddr} ${spi_koffset} ${spi_klen}; then " \
425 			"setenv bootargs console=${console},${baudrate} " \
426 				"root=/dev/mtdblock3 " \
427 				"rootfstype=squashfs,jffs2 " \
428 				"${video} ${extra}; " \
429 			"bootm; " \
430 		"fi\0"
431 #else
432 	#define CONFIG_EXTRA_ENV_SETTINGS \
433 	CONFIG_EXTRA_ENV_SETTINGS_COMMON \
434 	\
435 	"image_rootfs=openwrt-imx6-ventana-rootfs.ubi\0" \
436 	"nand_update=echo Updating NAND from ${serverip}:${image_rootfs}...; " \
437 		"tftp ${loadaddr} ${image_rootfs} && " \
438 		"nand erase.part rootfs && " \
439 		"nand write ${loadaddr} rootfs ${filesize}\0" \
440 	\
441 	"flash_boot=" \
442 		"setenv fsload 'ubifsload'; " \
443 		"ubi part rootfs; " \
444 		"if ubi check boot; then " \
445 			"ubifsmount ubi0:boot; " \
446 			"setenv root ubi0:rootfs ubi.mtd=2 " \
447 				"rootfstype=squashfs,ubifs; " \
448 			"setenv bootdir; " \
449 		"elif ubi check rootfs; then " \
450 			"ubifsmount ubi0:rootfs; " \
451 			"setenv root ubi0:rootfs ubi.mtd=2 " \
452 				"rootfstype=ubifs; " \
453 		"fi; " \
454 		"run loadscript; " \
455 		"if ${fsload} ${loadaddr} ${bootdir}/${uimage}; then " \
456 			"setenv bootargs console=${console},${baudrate} " \
457 				"root=${root} ${video} ${extra}; " \
458 			"if run loadfdt && fdt addr ${fdt_addr}; then " \
459 				"ubifsumount; " \
460 				"bootm ${loadaddr} - ${fdt_addr}; " \
461 			"else " \
462 				"ubifsumount; bootm; " \
463 			"fi; " \
464 		"fi\0"
465 #endif
466 
467 #define CONFIG_BOOTCOMMAND \
468 	"for btype in ${bootdevs}; do " \
469 		"echo; echo Attempting ${btype} boot...; " \
470 		"if run ${btype}_boot; then; fi; " \
471 	"done"
472 
473 /* Device Tree Support */
474 #define CONFIG_OF_BOARD_SETUP
475 #define CONFIG_OF_LIBFDT
476 #define CONFIG_FDT_FIXUP_PARTITIONS
477 
478 #ifndef CONFIG_SYS_DCACHE_OFF
479   #define CONFIG_CMD_CACHE
480 #endif
481 
482 #endif			       /* __CONFIG_H */
483