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