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