xref: /openbmc/u-boot/include/configs/gw_ventana.h (revision dd580801)
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_SPEED		100000
99 #define CONFIG_I2C_GSC			0
100 #define CONFIG_I2C_PMIC			1
101 
102 /* MMC Configs */
103 #define CONFIG_FSL_ESDHC
104 #define CONFIG_FSL_USDHC
105 #define CONFIG_SYS_FSL_ESDHC_ADDR      0
106 #define CONFIG_SYS_FSL_USDHC_NUM       1
107 #define CONFIG_MMC
108 #define CONFIG_CMD_MMC
109 #define CONFIG_GENERIC_MMC
110 #define CONFIG_BOUNCE_BUFFER
111 
112 /* Filesystem support */
113 #define CONFIG_CMD_EXT2
114 #define CONFIG_CMD_FAT
115 #define CONFIG_CMD_UBIFS
116 #define CONFIG_DOS_PARTITION
117 
118 /* Network config - Allow larger/faster download for TFTP/NFS */
119 #define CONFIG_IP_DEFRAG
120 #define CONFIG_TFTP_BLOCKSIZE 4096
121 #define CONFIG_NFS_READ_SIZE  4096
122 
123 /*
124  * SATA Configs
125  */
126 #define CONFIG_CMD_SATA
127 #ifdef CONFIG_CMD_SATA
128   #define CONFIG_DWC_AHSATA
129   #define CONFIG_SYS_SATA_MAX_DEVICE	1
130   #define CONFIG_DWC_AHSATA_PORT_ID	0
131   #define CONFIG_DWC_AHSATA_BASE_ADDR	SATA_ARB_BASE_ADDR
132   #define CONFIG_LBA48
133   #define CONFIG_LIBATA
134 #endif
135 
136 /*
137  * PCI express
138  */
139 #define CONFIG_CMD_PCI
140 #ifdef CONFIG_CMD_PCI
141 #define CONFIG_PCI
142 #define CONFIG_PCI_PNP
143 #define CONFIG_PCI_SCAN_SHOW
144 #define CONFIG_PCI_FIXUP_DEV
145 #define CONFIG_PCIE_IMX
146 #endif
147 
148 /*
149  * PMIC
150  */
151 #define CONFIG_POWER
152 #define CONFIG_POWER_I2C
153 #define CONFIG_POWER_PFUZE100
154 #define CONFIG_POWER_PFUZE100_I2C_ADDR	0x08
155 #define CONFIG_POWER_LTC3676
156 #define CONFIG_POWER_LTC3676_I2C_ADDR  0x3c
157 
158 /* Various command support */
159 #include <config_cmd_default.h>
160 #undef CONFIG_CMD_IMLS
161 #define CONFIG_CMD_PING
162 #define CONFIG_CMD_DHCP
163 #define CONFIG_CMD_MII
164 #define CONFIG_CMD_NET
165 #define CONFIG_CMD_BMODE         /* set eFUSE shadow for a boot dev and reset */
166 #define CONFIG_CMD_HDMIDETECT    /* detect HDMI output device */
167 #define CONFIG_CMD_SETEXPR
168 #define CONFIG_CMD_BOOTZ
169 #define CONFIG_CMD_GSC
170 #define CONFIG_CMD_EECONFIG      /* Gateworks EEPROM config cmd */
171 #define CONFIG_CMD_UBI
172 #define CONFIG_RBTREE
173 #define CONFIG_LZO
174 #define CONFIG_CMD_FUSE          /* eFUSE read/write support */
175 #ifdef CONFIG_CMD_FUSE
176 #define CONFIG_MXC_OCOTP
177 #endif
178 
179 
180 /* Ethernet support */
181 #define CONFIG_FEC_MXC
182 #define CONFIG_MII
183 #define IMX_FEC_BASE             ENET_BASE_ADDR
184 #define CONFIG_FEC_XCV_TYPE      RGMII
185 #define CONFIG_ETHPRIME          "FEC"
186 #define CONFIG_FEC_MXC_PHYADDR   0
187 #define CONFIG_PHYLIB
188 #define CONFIG_ARP_TIMEOUT       200UL
189 
190 /* USB Configs */
191 #define CONFIG_CMD_USB
192 #define CONFIG_USB_EHCI
193 #define CONFIG_USB_EHCI_MX6
194 #define CONFIG_USB_STORAGE
195 #define CONFIG_USB_HOST_ETHER
196 #define CONFIG_USB_ETHER_ASIX
197 #define CONFIG_USB_ETHER_SMSC95XX
198 #define CONFIG_USB_MAX_CONTROLLER_COUNT 2
199 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET  /* For OTG port */
200 #define CONFIG_MXC_USB_PORTSC     (PORT_PTS_UTMI | PORT_PTS_PTW)
201 #define CONFIG_MXC_USB_FLAGS      0
202 #define CONFIG_USB_KEYBOARD
203 #define CONFIG_CI_UDC
204 #define CONFIG_USBD_HS
205 #define CONFIG_USB_GADGET_DUALSPEED
206 #define CONFIG_USB_ETHER
207 #define CONFIG_USB_ETH_CDC
208 #define CONFIG_NETCONSOLE
209 #define CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP
210 
211 /* Framebuffer and LCD */
212 #define CONFIG_VIDEO
213 #define CONFIG_VIDEO_IPUV3
214 #define CONFIG_CFB_CONSOLE
215 #define CONFIG_VGA_AS_SINGLE_DEVICE
216 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
217 #define CONFIG_VIDEO_BMP_RLE8
218 #define CONFIG_SPLASH_SCREEN
219 #define CONFIG_BMP_16BPP
220 #define CONFIG_VIDEO_LOGO
221 #define CONFIG_IPUV3_CLK          260000000
222 #define CONFIG_CMD_HDMIDETECT
223 #define CONFIG_CONSOLE_MUX
224 #define CONFIG_IMX_HDMI
225 #define CONFIG_IMX_VIDEO_SKIP
226 
227 /* serial console (ttymxc1,115200) */
228 #define CONFIG_CONS_INDEX              1
229 #define CONFIG_BAUDRATE                115200
230 
231 /* Miscellaneous configurable options */
232 #define CONFIG_SYS_LONGHELP
233 #define CONFIG_SYS_HUSH_PARSER
234 #define CONFIG_SYS_PROMPT	             "Ventana > "
235 #define CONFIG_SYS_CBSIZE	             1024
236 #define CONFIG_AUTO_COMPLETE
237 #define CONFIG_CMDLINE_EDITING
238 #define CONFIG_HWCONFIG
239 
240 /* Print Buffer Size */
241 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
242 #define CONFIG_SYS_MAXARGS	           16
243 #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
244 
245 /* Memory configuration */
246 #define CONFIG_SYS_MEMTEST_START       0x10000000
247 #define CONFIG_SYS_MEMTEST_END	       0x10010000
248 #define CONFIG_SYS_MEMTEST_SCRATCH     0x10800000
249 #define CONFIG_SYS_TEXT_BASE	         0x17800000
250 #define CONFIG_SYS_LOAD_ADDR           0x12000000
251 
252 /* Physical Memory Map */
253 #define CONFIG_NR_DRAM_BANKS           1
254 #define PHYS_SDRAM                     MMDC0_ARB_BASE_ADDR
255 #define CONFIG_SYS_SDRAM_BASE          PHYS_SDRAM
256 #define CONFIG_SYS_INIT_RAM_ADDR       IRAM_BASE_ADDR
257 #define CONFIG_SYS_INIT_RAM_SIZE       IRAM_SIZE
258 
259 #define CONFIG_SYS_INIT_SP_OFFSET \
260 	(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
261 #define CONFIG_SYS_INIT_SP_ADDR \
262 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
263 
264 /* FLASH and environment organization */
265 #define CONFIG_SYS_NO_FLASH  /* no NOR flash */
266 
267 /*
268  * MTD Command for mtdparts
269  */
270 #define CONFIG_CMD_MTDPARTS
271 #define CONFIG_MTD_DEVICE
272 #define CONFIG_MTD_PARTITIONS
273 #ifdef CONFIG_SPI_FLASH
274 #define MTDIDS_DEFAULT    "nor0=nor"
275 #define MTDPARTS_DEFAULT  \
276 	"mtdparts=nor:512k(uboot),64k(env),2m(kernel),-(rootfs)"
277 #else
278 #define MTDIDS_DEFAULT    "nand0=nand"
279 #define MTDPARTS_DEFAULT  "mtdparts=nand:16m(uboot),1m(env),-(rootfs)"
280 #endif
281 
282 /* Persistent Environment Config */
283 #define CONFIG_ENV_OVERWRITE    /* allow to overwrite serial and ethaddr */
284 #ifdef CONFIG_SPI_FLASH
285 #define CONFIG_ENV_IS_IN_SPI_FLASH
286 #else
287 #define CONFIG_ENV_IS_IN_NAND
288 #endif
289 #if defined(CONFIG_ENV_IS_IN_MMC)
290   #define CONFIG_ENV_OFFSET              (6 * 64 * 1024)
291   #define CONFIG_ENV_SIZE                (8 * 1024)
292   #define CONFIG_SYS_MMC_ENV_DEV         0
293 #elif defined(CONFIG_ENV_IS_IN_NAND)
294   #define CONFIG_ENV_OFFSET              (16 << 20)
295   #define CONFIG_ENV_SECT_SIZE           (128 << 10)
296   #define CONFIG_ENV_SIZE                CONFIG_ENV_SECT_SIZE
297   #define CONFIG_ENV_OFFSET_REDUND       (CONFIG_ENV_OFFSET + (512 << 10))
298   #define CONFIG_ENV_SIZE_REDUND         CONFIG_ENV_SIZE
299 #elif defined(CONFIG_ENV_IS_IN_SPI_FLASH)
300   #define CONFIG_ENV_OFFSET              (512 * 1024)
301   #define CONFIG_ENV_SECT_SIZE           (64 * 1024)
302   #define CONFIG_ENV_SIZE                (8 * 1024)
303   #define CONFIG_ENV_SPI_BUS             CONFIG_SF_DEFAULT_BUS
304   #define CONFIG_ENV_SPI_CS              CONFIG_SF_DEFAULT_CS
305   #define CONFIG_ENV_SPI_MODE            CONFIG_SF_DEFAULT_MODE
306   #define CONFIG_ENV_SPI_MAX_HZ          CONFIG_SF_DEFAULT_SPEED
307 #endif
308 
309 /* Environment */
310 #define CONFIG_BOOTDELAY          3
311 #define CONFIG_LOADADDR           CONFIG_SYS_LOAD_ADDR
312 #define CONFIG_IPADDR             192.168.1.1
313 #define CONFIG_SERVERIP           192.168.1.146
314 #define HWCONFIG_DEFAULT \
315 	"hwconfig=rs232;" \
316 	"dio0:mode=gpio;dio1:mode=gpio;dio2:mode=gpio;dio3:mode=gpio\0" \
317 
318 #define CONFIG_EXTRA_ENV_SETTINGS_COMMON \
319 	"console=ttymxc1\0" \
320 	"bootdevs=usb mmc sata flash\0" \
321 	HWCONFIG_DEFAULT \
322 	"video=\0" \
323 	\
324 	"mtdparts=" MTDPARTS_DEFAULT "\0" \
325 	"mtdids=" MTDIDS_DEFAULT "\0" \
326 	\
327 	"fdt_high=0xffffffff\0" \
328 	"fdt_addr=0x18000000\0" \
329 	"loadfdt=" \
330 		"if ${fsload} ${fdt_addr} boot/${fdt_file}; then " \
331 			"echo Loaded DTB from boot/${fdt_file}; " \
332 		"elif ${fsload} ${fdt_addr} boot/${fdt_file1}; then " \
333 			"echo Loaded DTB from boot/${fdt_file1}; " \
334 		"elif ${fsload} ${fdt_addr} boot/${fdt_file2}; then " \
335 				"echo Loaded DTB from boot/${fdt_file2}; " \
336 		"fi\0" \
337 	\
338 	"script=boot/6x_bootscript-ventana\0" \
339 	"loadscript=" \
340 		"if ${fsload} ${loadaddr} ${script}; then " \
341 			"source; " \
342 		"fi\0" \
343 	\
344 	"uimage=boot/uImage\0" \
345 	"mmc_root=/dev/mmcblk0p1 rootfstype=ext4 rootwait rw\0" \
346 	"mmc_boot=" \
347 		"setenv fsload 'ext2load mmc 0:1'; " \
348 		"mmc dev 0 && mmc rescan && " \
349 		"run loadscript; " \
350 		"if ${fsload} ${loadaddr} ${uimage}; then " \
351 			"setenv bootargs console=${console},${baudrate} " \
352 				"root=/dev/mmcblk0p1 rootfstype=ext4 " \
353 				"rootwait rw ${video} ${extra}; " \
354 			"if run loadfdt && fdt addr ${fdt_addr}; then " \
355 				"bootm ${loadaddr} - ${fdt_addr}; " \
356 			"else " \
357 				"bootm; " \
358 			"fi; " \
359 		"fi\0" \
360 	\
361 	"sata_boot=" \
362 		"setenv fsload 'ext2load sata 0:1'; sata init && " \
363 		"run loadscript; " \
364 		"if ${fsload} ${loadaddr} ${uimage}; then " \
365 			"setenv bootargs console=${console},${baudrate} " \
366 				"root=/dev/sda1 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 	"usb_boot=" \
375 		"setenv fsload 'ext2load usb 0:1'; usb start && usb dev 0 && " \
376 		"run loadscript; " \
377 		"if ${fsload} ${loadaddr} ${uimage}; then " \
378 			"setenv bootargs console=${console},${baudrate} " \
379 				"root=/dev/sda1 rootfstype=ext4 " \
380 				"rootwait rw ${video} ${extra}; " \
381 			"if run loadfdt && fdt addr ${fdt_addr}; then " \
382 				"bootm ${loadaddr} - ${fdt_addr}; " \
383 			"else " \
384 				"bootm; " \
385 			"fi; " \
386 		"fi\0"
387 
388 #ifdef CONFIG_SPI_FLASH
389 	#define CONFIG_EXTRA_ENV_SETTINGS \
390 	CONFIG_EXTRA_ENV_SETTINGS_COMMON \
391 	"image_os=ventana/openwrt-imx6-imx6q-gw5400-a-squashfs.bin\0" \
392 	"image_uboot=ventana/u-boot_spi.imx\0" \
393 	\
394 	"spi_koffset=0x90000\0" \
395 	"spi_klen=0x200000\0" \
396 	\
397 	"spi_updateuboot=echo Updating uboot from " \
398 		"${serverip}:${image_uboot}...; " \
399 		"tftpboot ${loadaddr} ${image_uboot} && " \
400 		"sf probe && sf erase 0 80000 && " \
401 			"sf write ${loadaddr} 400 ${filesize}\0" \
402 	"spi_update=echo Updating OS from ${serverip}:${image_os} " \
403 		"to ${spi_koffset} ...; " \
404 		"tftp ${loadaddr} ${image_os} && " \
405 		"sf probe && " \
406 		"sf update ${loadaddr} ${spi_koffset} ${filesize}\0" \
407 	\
408 	"flash_boot=" \
409 		"if sf probe && " \
410 		"sf read ${loadaddr} ${spi_koffset} ${spi_klen}; then " \
411 			"setenv bootargs console=${console},${baudrate} " \
412 				"root=/dev/mtdblock3 " \
413 				"rootfstype=squashfs,jffs2 " \
414 				"${video} ${extra}; " \
415 			"bootm; " \
416 		"fi\0"
417 #else
418 	#define CONFIG_EXTRA_ENV_SETTINGS \
419 	CONFIG_EXTRA_ENV_SETTINGS_COMMON \
420 	"image_rootfs=openwrt-imx6-ventana-rootfs.ubi\0" \
421 	\
422 	"nand_update=echo Updating NAND from ${serverip}:${image_rootfs}...; " \
423 		"tftp ${loadaddr} ${image_rootfs} && " \
424 		"nand erase.part rootfs && " \
425 		"nand write ${loadaddr} rootfs ${filesize}\0" \
426 	\
427 	"flash_boot=" \
428 		"setenv fsload 'ubifsload'; " \
429 		"ubi part rootfs && ubifsmount ubi0:rootfs; " \
430 		"run loadscript; " \
431 		"if ${fsload} ${loadaddr} ${uimage}; then " \
432 			"setenv bootargs console=${console},${baudrate} " \
433 				"root=ubi0:rootfs ubi.mtd=2 " \
434 				"rootfstype=ubifs ${video} ${extra}; " \
435 			"if run loadfdt && fdt addr ${fdt_addr}; then " \
436 				"ubifsumount; " \
437 				"bootm ${loadaddr} - ${fdt_addr}; " \
438 			"else " \
439 				"ubifsumount; bootm; " \
440 			"fi; " \
441 		"fi\0"
442 #endif
443 
444 #define CONFIG_BOOTCOMMAND \
445 	"for btype in ${bootdevs}; do " \
446 		"echo; echo Attempting ${btype} boot...; " \
447 		"if run ${btype}_boot; then; fi; " \
448 	"done"
449 
450 /* Device Tree Support */
451 #define CONFIG_OF_BOARD_SETUP
452 #define CONFIG_OF_LIBFDT
453 #define CONFIG_FDT_FIXUP_PARTITIONS
454 
455 #ifndef CONFIG_SYS_DCACHE_OFF
456   #define CONFIG_CMD_CACHE
457 #endif
458 
459 #endif			       /* __CONFIG_H */
460