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