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