1 /*
2  * Copyright 2013-2015 Toradex, Inc.
3  *
4  * Configuration settings for the Toradex Colibri iMX6
5  *
6  * SPDX-License-Identifier:	GPL-2.0+
7  */
8 
9 #ifndef __CONFIG_H
10 #define __CONFIG_H
11 
12 #include "mx6_common.h"
13 
14 #undef CONFIG_DISPLAY_BOARDINFO
15 
16 #define CONFIG_SYS_GENERIC_BOARD
17 
18 #include <asm/arch/imx-regs.h>
19 #include <asm/mach-imx/gpio.h>
20 
21 #ifdef CONFIG_SPL
22 #include "imx6_spl.h"
23 #endif
24 
25 #define CONFIG_CMDLINE_TAG
26 #define CONFIG_SETUP_MEMORY_TAGS
27 #define CONFIG_INITRD_TAG
28 #define CONFIG_REVISION_TAG
29 #define CONFIG_SERIAL_TAG
30 
31 /* Size of malloc() pool */
32 #define CONFIG_SYS_MALLOC_LEN		(32 * 1024 * 1024)
33 
34 #define CONFIG_MISC_INIT_R
35 
36 #define CONFIG_MXC_UART
37 #define CONFIG_MXC_UART_BASE		UART1_BASE
38 
39 /* I2C Configs */
40 #define CONFIG_SYS_I2C
41 #define CONFIG_SYS_I2C_MXC
42 #define CONFIG_SYS_I2C_MXC_I2C1         /* enable I2C bus 1 */
43 #define CONFIG_SYS_I2C_MXC_I2C2         /* enable I2C bus 2 */
44 #define CONFIG_SYS_I2C_MXC_I2C3         /* enable I2C bus 3 */
45 #define CONFIG_SYS_I2C_SPEED		100000
46 
47 /* OCOTP Configs */
48 #ifdef CONFIG_CMD_FUSE
49 #define CONFIG_MXC_OCOTP
50 #endif
51 
52 /* MMC Configs */
53 #define CONFIG_FSL_USDHC
54 #define CONFIG_SYS_FSL_ESDHC_ADDR	0
55 #define CONFIG_SYS_FSL_USDHC_NUM	2
56 
57 #define CONFIG_SUPPORT_EMMC_BOOT	/* eMMC specific */
58 #define CONFIG_BOUNCE_BUFFER
59 
60 /* Network */
61 #define CONFIG_FEC_MXC
62 #define CONFIG_MII
63 #define IMX_FEC_BASE			ENET_BASE_ADDR
64 #define CONFIG_FEC_XCV_TYPE		RMII
65 #define CONFIG_ETHPRIME			"FEC"
66 #define CONFIG_FEC_MXC_PHYADDR		1
67 #define CONFIG_IP_DEFRAG
68 #define CONFIG_TFTP_BLOCKSIZE		16352
69 #define CONFIG_TFTP_TSIZE
70 
71 /* USB Configs */
72 /* Host */
73 #define CONFIG_USB_MAX_CONTROLLER_COUNT		2
74 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET	/* For OTG port */
75 #define CONFIG_MXC_USB_PORTSC		(PORT_PTS_UTMI | PORT_PTS_PTW)
76 #define CONFIG_MXC_USB_FLAGS		0
77 /* Client */
78 #define CONFIG_USBD_HS
79 
80 #define CONFIG_USB_GADGET_MASS_STORAGE
81 /* USB DFU */
82 #define CONFIG_DFU_MMC
83 
84 /* Miscellaneous commands */
85 
86 /* Framebuffer and LCD */
87 #define CONFIG_VIDEO_IPUV3
88 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
89 #define CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
90 #define CONFIG_VIDEO_BMP_RLE8
91 #define CONFIG_SPLASH_SCREEN
92 #define CONFIG_SPLASH_SCREEN_ALIGN
93 #define CONFIG_BMP_16BPP
94 #define CONFIG_VIDEO_LOGO
95 #define CONFIG_VIDEO_BMP_LOGO
96 #define CONFIG_CONSOLE_MUX
97 #define CONFIG_IMX_HDMI
98 #define CONFIG_IMX_VIDEO_SKIP
99 
100 /* allow to overwrite serial and ethaddr */
101 #define CONFIG_ENV_OVERWRITE
102 
103 /* Command definition */
104 #undef CONFIG_CMD_LOADB
105 #undef CONFIG_CMD_LOADS
106 #undef CONFIG_CMD_NFS
107 #undef CONFIG_CMD_FLASH
108 
109 #undef CONFIG_IPADDR
110 #define CONFIG_IPADDR			192.168.10.2
111 #define CONFIG_NETMASK			255.255.255.0
112 #undef CONFIG_SERVERIP
113 #define CONFIG_SERVERIP			192.168.10.1
114 
115 #define CONFIG_LOADADDR			0x12000000
116 
117 #ifdef CONFIG_CMD_MMC
118 #define CONFIG_DRIVE_MMC "mmc "
119 #else
120 #define CONFIG_DRIVE_MMC
121 #endif
122 
123 #define CONFIG_DRIVE_TYPES CONFIG_DRIVE_MMC
124 
125 #define DFU_ALT_EMMC_INFO \
126 	"u-boot.imx raw 0x2 0x3ff mmcpart 0;" \
127 	"boot part 0 1;" \
128 	"rootfs part 0 2;" \
129 	"uImage fat 0 1;" \
130 	"imx6q-colibri-eval-v3.dtb fat 0 1;" \
131 	"imx6q-colibri-cam-eval-v3.dtb fat 0 1"
132 
133 #define EMMC_BOOTCMD \
134 	"emmcargs=ip=off root=/dev/mmcblk0p2 rw,noatime rootfstype=ext3 " \
135 		"rootwait\0" \
136 	"emmcboot=run setup; " \
137 		"setenv bootargs ${defargs} ${emmcargs} ${setupargs} " \
138 		"${vidargs}; echo Booting from internal eMMC chip...; "	\
139 		"run emmcdtbload; load mmc 0:1 ${kernel_addr_r} " \
140 		"${boot_file} && run fdt_fixup && " \
141 		"bootm ${kernel_addr_r} ${dtbparam}\0" \
142 	"emmcdtbload=setenv dtbparam; load mmc 0:1 ${fdt_addr_r} " \
143 		"${fdt_file} && setenv dtbparam \" - ${fdt_addr_r}\" && true\0"
144 
145 #define MEM_LAYOUT_ENV_SETTINGS \
146 	"bootm_size=0x10000000\0" \
147 	"fdt_addr_r=0x12000000\0" \
148 	"fdt_high=0xffffffff\0" \
149 	"initrd_high=0xffffffff\0" \
150 	"kernel_addr_r=0x11000000\0" \
151 	"ramdisk_addr_r=0x12100000\0"
152 
153 #define NFS_BOOTCMD \
154 	"nfsargs=ip=:::::eth0:on root=/dev/nfs rw\0" \
155 	"nfsboot=run setup; " \
156 		"setenv bootargs ${defargs} ${nfsargs} ${setupargs} " \
157 		"${vidargs}; echo Booting via DHCP/TFTP/NFS...; " \
158 		"run nfsdtbload; dhcp ${kernel_addr_r} " \
159 		"&& run fdt_fixup && bootm ${kernel_addr_r} ${dtbparam}\0" \
160 	"nfsdtbload=setenv dtbparam; tftp ${fdt_addr_r} ${fdt_file} " \
161 		"&& setenv dtbparam \" - ${fdt_addr_r}\" && true\0"
162 
163 #define SD_BOOTCMD						\
164 	"sdargs=ip=off root=/dev/mmcblk1p2 rw,noatime rootfstype=ext3 " \
165 		"rootwait\0" \
166 	"sdboot=run setup; " \
167 		"setenv bootargs ${defargs} ${sdargs} ${setupargs} " \
168 		"${vidargs}; echo Booting from SD card; " \
169 		"run sddtbload; load mmc 1:1 ${kernel_addr_r} " \
170 		"${boot_file} && run fdt_fixup && " \
171 		"bootm ${kernel_addr_r} ${dtbparam}\0" \
172 	"sddtbload=setenv dtbparam; load mmc 1:1 ${fdt_addr_r} " \
173 		"${fdt_file} && setenv dtbparam \" - ${fdt_addr_r}\" && true\0"
174 
175 #define USB_BOOTCMD \
176 	"usbargs=ip=off root=/dev/sda2 rw,noatime rootfstype=ext3 " \
177 		"rootwait\0" \
178 	"usbboot=run setup; setenv bootargs ${defargs} ${setupargs} " \
179 		"${usbargs} ${vidargs}; echo Booting from USB stick...; " \
180 		"usb start && run usbdtbload; load usb 0:1 ${kernel_addr_r} " \
181 		"${boot_file} && run fdt_fixup && " \
182 		"bootm ${kernel_addr_r} ${dtbparam}\0" \
183 	"usbdtbload=setenv dtbparam; load usb 0:1 ${fdt_addr_r} " \
184 		"${fdt_file} && setenv dtbparam \" - ${fdt_addr_r}\" && true\0"
185 
186 #define FDT_FILE "imx6dl-colibri-eval-v3.dtb"
187 #define CONFIG_EXTRA_ENV_SETTINGS \
188 	"bootcmd=run emmcboot ; echo ; echo emmcboot failed ; " \
189 		"run nfsboot ; echo ; echo nfsboot failed ; " \
190 		"usb start ;" \
191 		"setenv stdout serial,vga ; setenv stdin serial,usbkbd\0" \
192 	"boot_file=uImage\0" \
193 	"console=ttymxc0\0" \
194 	"defargs=enable_wait_mode=off galcore.contiguousSize=50331648\0" \
195 	"dfu_alt_info=" DFU_ALT_EMMC_INFO "\0" \
196 	EMMC_BOOTCMD \
197 	"fdt_file=" FDT_FILE "\0" \
198 	"fdt_fixup=;\0" \
199 	MEM_LAYOUT_ENV_SETTINGS \
200 	NFS_BOOTCMD \
201 	SD_BOOTCMD \
202 	"setethupdate=if env exists ethaddr; then; else setenv ethaddr " \
203 		"00:14:2d:00:00:00; fi; tftpboot ${loadaddr} " \
204 		"flash_eth.img && source ${loadaddr}\0" \
205 	"setsdupdate=setenv interface mmc; setenv drive 1; mmc rescan; load " \
206 		"${interface} ${drive}:1 ${loadaddr} flash_blk.img && " \
207 		"source ${loadaddr}\0" \
208 	"setup=setenv setupargs fec_mac=${ethaddr} " \
209 		"consoleblank=0 no_console_suspend=1 console=tty1 " \
210 		"console=${console},${baudrate}n8\0 " \
211 	"setupdate=run setsdupdate || run setusbupdate || run setethupdate\0" \
212 	"setusbupdate=usb start && setenv interface usb; setenv drive 0; " \
213 		"load ${interface} ${drive}:1 ${loadaddr} flash_blk.img && " \
214 		"source ${loadaddr}\0" \
215 	"splashpos=m,m\0" \
216 	"vidargs=video=mxcfb0:dev=lcd,640x480M@60,if=RGB666 " \
217 		"video=mxcfb1:off fbmem=8M\0 "
218 
219 /* Miscellaneous configurable options */
220 #undef CONFIG_SYS_CBSIZE
221 #define CONFIG_SYS_CBSIZE		1024
222 #undef CONFIG_SYS_MAXARGS
223 #define CONFIG_SYS_MAXARGS		48
224 
225 #define CONFIG_SYS_MEMTEST_START	0x10000000
226 #define CONFIG_SYS_MEMTEST_END		0x10010000
227 #define CONFIG_SYS_MEMTEST_SCRATCH	0x10800000
228 
229 #define CONFIG_SYS_LOAD_ADDR		CONFIG_LOADADDR
230 
231 /* Physical Memory Map */
232 #define CONFIG_NR_DRAM_BANKS		1
233 #define PHYS_SDRAM			MMDC0_ARB_BASE_ADDR
234 
235 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM
236 #define CONFIG_SYS_INIT_RAM_ADDR	IRAM_BASE_ADDR
237 #define CONFIG_SYS_INIT_RAM_SIZE	IRAM_SIZE
238 
239 #define CONFIG_SYS_INIT_SP_OFFSET \
240 	(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
241 #define CONFIG_SYS_INIT_SP_ADDR \
242 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
243 
244 /* environment organization */
245 #define CONFIG_ENV_SIZE			(8 * 1024)
246 
247 #if defined(CONFIG_ENV_IS_IN_MMC)
248 /* Environment in eMMC, before config block at the end of 1st "boot sector" */
249 #define CONFIG_ENV_OFFSET		(-CONFIG_ENV_SIZE + \
250 					 CONFIG_TDX_CFG_BLOCK_OFFSET)
251 #define CONFIG_SYS_MMC_ENV_DEV		0
252 #define CONFIG_SYS_MMC_ENV_PART		1
253 #endif
254 
255 #define CONFIG_OF_SYSTEM_SETUP
256 
257 #define CONFIG_CMD_TIME
258 
259 #endif	/* __CONFIG_H */
260