1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright 2013-2015 Toradex, Inc.
4  *
5  * Configuration settings for the Toradex Apalis 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_MACH_TYPE		4886
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	3
55 
56 #define CONFIG_SUPPORT_EMMC_BOOT	/* eMMC specific */
57 
58 /*
59  * SATA Configs
60  */
61 #ifdef CONFIG_CMD_SATA
62 #define CONFIG_SYS_SATA_MAX_DEVICE	1
63 #define CONFIG_DWC_AHSATA_PORT_ID	0
64 #define CONFIG_DWC_AHSATA_BASE_ADDR	SATA_ARB_BASE_ADDR
65 #define CONFIG_LBA48
66 #endif
67 
68 /* Network */
69 #define CONFIG_FEC_MXC
70 #define CONFIG_MII
71 #define IMX_FEC_BASE			ENET_BASE_ADDR
72 #define CONFIG_FEC_XCV_TYPE		RGMII
73 #define CONFIG_ETHPRIME			"FEC"
74 #define CONFIG_FEC_MXC_PHYADDR		6
75 #define CONFIG_IP_DEFRAG
76 #define CONFIG_TFTP_BLOCKSIZE		4096
77 #define CONFIG_TFTP_TSIZE
78 
79 /* USB Configs */
80 /* Host */
81 #define CONFIG_USB_MAX_CONTROLLER_COUNT		2
82 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET	/* For OTG port */
83 #define CONFIG_MXC_USB_PORTSC		(PORT_PTS_UTMI | PORT_PTS_PTW)
84 #define CONFIG_MXC_USB_FLAGS		0
85 /* Client */
86 #define CONFIG_USBD_HS
87 
88 #define CONFIG_USB_GADGET_MASS_STORAGE
89 /* USB DFU */
90 #define CONFIG_DFU_MMC
91 
92 /* Miscellaneous commands */
93 
94 /* Framebuffer and LCD */
95 #define CONFIG_VIDEO_IPUV3
96 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
97 #define CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
98 #define CONFIG_VIDEO_BMP_RLE8
99 #define CONFIG_SPLASH_SCREEN
100 #define CONFIG_SPLASH_SCREEN_ALIGN
101 #define CONFIG_BMP_16BPP
102 #define CONFIG_VIDEO_LOGO
103 #define CONFIG_VIDEO_BMP_LOGO
104 #define CONFIG_CONSOLE_MUX
105 #define CONFIG_IMX_HDMI
106 #define CONFIG_IMX_VIDEO_SKIP
107 
108 /* allow to overwrite serial and ethaddr */
109 #define CONFIG_ENV_OVERWRITE
110 
111 /* Command definition */
112 #undef CONFIG_CMD_LOADB
113 #undef CONFIG_CMD_LOADS
114 #undef CONFIG_CMD_NFS
115 #undef CONFIG_CMD_FLASH
116 
117 #undef CONFIG_IPADDR
118 #define CONFIG_IPADDR			192.168.10.2
119 #define CONFIG_NETMASK			255.255.255.0
120 #undef CONFIG_SERVERIP
121 #define CONFIG_SERVERIP			192.168.10.1
122 
123 #define CONFIG_LOADADDR			0x12000000
124 
125 #ifdef CONFIG_CMD_SATA
126 #define CONFIG_DRIVE_SATA "sata "
127 #else
128 #define CONFIG_DRIVE_SATA
129 #endif
130 
131 #ifdef CONFIG_CMD_MMC
132 #define CONFIG_DRIVE_MMC "mmc "
133 #else
134 #define CONFIG_DRIVE_MMC
135 #endif
136 
137 #define CONFIG_DRIVE_TYPES CONFIG_DRIVE_SATA CONFIG_DRIVE_MMC
138 
139 #define DFU_ALT_EMMC_INFO \
140 	"u-boot.imx raw 0x2 0x3ff mmcpart 0;" \
141 	"boot part 0 1;" \
142 	"rootfs part 0 2;" \
143 	"uImage fat 0 1;" \
144 	"imx6q-colibri-eval-v3.dtb fat 0 1;" \
145 	"imx6q-colibri-cam-eval-v3.dtb fat 0 1"
146 
147 #define EMMC_BOOTCMD \
148 	"emmcargs=ip=off root=/dev/mmcblk0p2 rw,noatime rootfstype=ext3 " \
149 		"rootwait\0" \
150 	"emmcboot=run setup; " \
151 		"setenv bootargs ${defargs} ${emmcargs} ${setupargs} " \
152 		"${vidargs}; echo Booting from internal eMMC chip...; "	\
153 		"run emmcdtbload; load mmc 0:1 ${kernel_addr_r} " \
154 		"${boot_file} && run fdt_fixup && " \
155 		"bootm ${kernel_addr_r} ${dtbparam}\0" \
156 	"emmcdtbload=setenv dtbparam; load mmc 0:1 ${fdt_addr_r} " \
157 		"${fdt_file} && setenv dtbparam \" - ${fdt_addr_r}\" && true\0"
158 
159 #define MEM_LAYOUT_ENV_SETTINGS \
160 	"bootm_size=0x20000000\0" \
161 	"fdt_addr_r=0x12000000\0" \
162 	"fdt_high=0xffffffff\0" \
163 	"initrd_high=0xffffffff\0" \
164 	"kernel_addr_r=0x11000000\0" \
165 	"ramdisk_addr_r=0x12100000\0"
166 
167 #define NFS_BOOTCMD \
168 	"nfsargs=ip=:::::eth0:on root=/dev/nfs rw\0" \
169 	"nfsboot=run setup; " \
170 		"setenv bootargs ${defargs} ${nfsargs} ${setupargs} " \
171 		"${vidargs}; echo Booting via DHCP/TFTP/NFS...; " \
172 		"run nfsdtbload; dhcp ${kernel_addr_r} " \
173 		"&& run fdt_fixup && bootm ${kernel_addr_r} ${dtbparam}\0" \
174 	"nfsdtbload=setenv dtbparam; tftp ${fdt_addr_r} ${fdt_file} " \
175 		"&& setenv dtbparam \" - ${fdt_addr_r}\" && true\0"
176 
177 #define SD_BOOTCMD						\
178 	"sdargs=ip=off root=/dev/mmcblk1p2 rw,noatime rootfstype=ext3 " \
179 		"rootwait\0" \
180 	"sdboot=run setup; " \
181 		"setenv bootargs ${defargs} ${sdargs} ${setupargs} " \
182 		"${vidargs}; echo Booting from SD card; " \
183 		"run sddtbload; load mmc 1:1 ${kernel_addr_r} " \
184 		"${boot_file} && run fdt_fixup && " \
185 		"bootm ${kernel_addr_r} ${dtbparam}\0" \
186 	"sddtbload=setenv dtbparam; load mmc 1:1 ${fdt_addr_r} " \
187 		"${fdt_file} && setenv dtbparam \" - ${fdt_addr_r}\" && true\0"
188 
189 #define USB_BOOTCMD \
190 	"usbargs=ip=off root=/dev/sda2 rw,noatime rootfstype=ext3 " \
191 		"rootwait\0" \
192 	"usbboot=run setup; setenv bootargs ${defargs} ${setupargs} " \
193 		"${usbargs} ${vidargs}; echo Booting from USB stick...; " \
194 		"usb start && run usbdtbload; load usb 0:1 ${kernel_addr_r} " \
195 		"${boot_file} && run fdt_fixup && " \
196 		"bootm ${kernel_addr_r} ${dtbparam}\0" \
197 	"usbdtbload=setenv dtbparam; load usb 0:1 ${fdt_addr_r} " \
198 		"${fdt_file} && setenv dtbparam \" - ${fdt_addr_r}\" && true\0"
199 
200 #ifndef CONFIG_TDX_APALIS_IMX6_V1_0
201 #define FDT_FILE "imx6q-apalis-eval.dtb"
202 #define FDT_FILE_V1_0 "imx6q-apalis_v1_0-eval.dtb"
203 #else
204 #define FDT_FILE "imx6q-apalis_v1_0-eval.dtb"
205 #endif
206 #define CONFIG_EXTRA_ENV_SETTINGS \
207 	"bootcmd=run emmcboot ; echo ; echo emmcboot failed ; " \
208 		"run nfsboot ; echo ; echo nfsboot failed ; " \
209 		"usb start ;" \
210 		"setenv stdout serial,vga ; setenv stdin serial,usbkbd\0" \
211 	"boot_file=uImage\0" \
212 	"console=ttymxc0\0" \
213 	"defargs=enable_wait_mode=off vmalloc=400M\0" \
214 	"dfu_alt_info=" DFU_ALT_EMMC_INFO "\0" \
215 	EMMC_BOOTCMD \
216 	"fdt_file=" FDT_FILE "\0" \
217 	"fdt_fixup=;\0" \
218 	MEM_LAYOUT_ENV_SETTINGS \
219 	NFS_BOOTCMD \
220 	SD_BOOTCMD \
221 	"setethupdate=if env exists ethaddr; then; else setenv ethaddr " \
222 		"00:14:2d:00:00:00; fi; tftpboot ${loadaddr} " \
223 		"flash_eth.img && source ${loadaddr}\0" \
224 	"setsdupdate=setenv interface mmc; setenv drive 1; mmc rescan; load " \
225 		"${interface} ${drive}:1 ${loadaddr} flash_blk.img && " \
226 		"source ${loadaddr}\0" \
227 	"setup=setenv setupargs fec_mac=${ethaddr} " \
228 		"consoleblank=0 no_console_suspend=1 console=tty1 " \
229 		"console=${console},${baudrate}n8\0 " \
230 	"setupdate=run setsdupdate || run setusbupdate || run setethupdate\0" \
231 	"setusbupdate=usb start && setenv interface usb; setenv drive 0; " \
232 		"load ${interface} ${drive}:1 ${loadaddr} flash_blk.img && " \
233 		"source ${loadaddr}\0" \
234 	"splashpos=m,m\0" \
235 	"vidargs=mxc_hdmi.only_cea=1 " \
236 		"video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24 " \
237 		"video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off " \
238 		"fbmem=32M\0 "
239 
240 /* Miscellaneous configurable options */
241 #undef CONFIG_SYS_CBSIZE
242 #define CONFIG_SYS_CBSIZE		1024
243 #undef CONFIG_SYS_MAXARGS
244 #define CONFIG_SYS_MAXARGS		48
245 
246 #define CONFIG_SYS_MEMTEST_START	0x10000000
247 #define CONFIG_SYS_MEMTEST_END		0x10010000
248 #define CONFIG_SYS_MEMTEST_SCRATCH	0x10800000
249 
250 #define CONFIG_SYS_LOAD_ADDR		CONFIG_LOADADDR
251 
252 /* Physical Memory Map */
253 #define CONFIG_NR_DRAM_BANKS		1
254 #define PHYS_SDRAM			MMDC0_ARB_BASE_ADDR
255 
256 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM
257 #define CONFIG_SYS_INIT_RAM_ADDR	IRAM_BASE_ADDR
258 #define CONFIG_SYS_INIT_RAM_SIZE	IRAM_SIZE
259 
260 #define CONFIG_SYS_INIT_SP_OFFSET \
261 	(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
262 #define CONFIG_SYS_INIT_SP_ADDR \
263 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
264 
265 /* environment organization */
266 
267 #define CONFIG_ENV_SIZE			(8 * 1024)
268 
269 #if defined(CONFIG_ENV_IS_IN_MMC)
270 /* Environment in eMMC, before config block at the end of 1st "boot sector" */
271 #define CONFIG_ENV_OFFSET		(-CONFIG_ENV_SIZE + \
272 					 CONFIG_TDX_CFG_BLOCK_OFFSET)
273 #define CONFIG_SYS_MMC_ENV_DEV		0
274 #define CONFIG_SYS_MMC_ENV_PART		1
275 #endif
276 
277 #define CONFIG_OF_SYSTEM_SETUP
278 
279 #define CONFIG_CMD_TIME
280 
281 #endif	/* __CONFIG_H */
282