1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Config file for Compulab CM-FX6 board
4  *
5  * Copyright (C) 2014, Compulab Ltd - http://compulab.co.il/
6  *
7  * Author: Nikita Kiryanov <nikita@compulab.co.il>
8  */
9 
10 #ifndef __CONFIG_CM_FX6_H
11 #define __CONFIG_CM_FX6_H
12 
13 #include "mx6_common.h"
14 
15 /* Machine config */
16 #define CONFIG_SYS_LITTLE_ENDIAN
17 #define CONFIG_MACH_TYPE		4273
18 
19 /* MMC */
20 #define CONFIG_SYS_FSL_USDHC_NUM	3
21 #define CONFIG_SYS_FSL_ESDHC_ADDR	USDHC2_BASE_ADDR
22 
23 /* RAM */
24 #define PHYS_SDRAM_1			MMDC0_ARB_BASE_ADDR
25 #define PHYS_SDRAM_2			MMDC1_ARB_BASE_ADDR
26 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM_1
27 #define CONFIG_SYS_INIT_RAM_ADDR	IRAM_BASE_ADDR
28 #define CONFIG_SYS_INIT_RAM_SIZE	IRAM_SIZE
29 #define CONFIG_SYS_INIT_SP_OFFSET \
30 	(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
31 #define CONFIG_SYS_INIT_SP_ADDR \
32 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
33 
34 /* Serial console */
35 #define CONFIG_MXC_UART_BASE		UART4_BASE
36 #define CONFIG_SYS_BAUDRATE_TABLE	{9600, 19200, 38400, 57600, 115200}
37 
38 /* Environment */
39 
40 #ifndef CONFIG_SPL_BUILD
41 #define CONFIG_EXTRA_ENV_SETTINGS \
42 	"fdt_high=0xffffffff\0" \
43 	"initrd_high=0xffffffff\0" \
44 	"fdt_addr_r=0x18000000\0" \
45 	"ramdisk_addr_r=0x13000000\0" \
46 	"kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
47 	"pxefile_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
48 	"scriptaddr=" __stringify(CONFIG_LOADADDR) "\0" \
49 	"fdtfile=undefined\0" \
50 	"stdin=serial,usbkbd\0" \
51 	"stdout=serial,vidconsole\0" \
52 	"stderr=serial,vidconsole\0" \
53 	"panel=HDMI\0" \
54 	"autoload=no\0" \
55 	"uImage=uImage-cm-fx6\0" \
56 	"zImage=zImage-cm-fx6\0" \
57 	"kernel=uImage-cm-fx6\0" \
58 	"dtb=cm-fx6.dtb\0" \
59 	"console=ttymxc3,115200\0" \
60 	"ethprime=FEC0\0" \
61 	"video_hdmi=mxcfb0:dev=hdmi,1920x1080M-32@50,if=RGB32\0" \
62 	"video_dvi=mxcfb0:dev=dvi,1280x800M-32@50,if=RGB32\0" \
63 	"doboot=bootm ${kernel_addr_r}\0" \
64 	"doloadfdt=false\0" \
65 	"mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \
66 	"mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
67 	"setboottypez=setenv kernel ${zImage};" \
68 		"setenv doboot bootz ${kernel_addr_r} - ${fdt_addr_r};" \
69 		"setenv doloadfdt true;\0" \
70 	"setboottypem=setenv kernel ${uImage};" \
71 		"setenv doboot bootm ${kernel_addr_r};" \
72 		"setenv doloadfdt false;\0"\
73 	"mmcroot=/dev/mmcblk0p2 rw rootwait\0" \
74 	"sataroot=/dev/sda2 rw rootwait\0" \
75 	"nandroot=/dev/mtdblock4 rw\0" \
76 	"nandrootfstype=ubifs\0" \
77 	"mmcargs=setenv bootargs console=${console} root=${mmcroot} " \
78 		"${video} ${extrabootargs}\0" \
79 	"sataargs=setenv bootargs console=${console} root=${sataroot} " \
80 		"${video} ${extrabootargs}\0" \
81 	"nandargs=setenv bootargs console=${console} " \
82 		"root=${nandroot} " \
83 		"rootfstype=${nandrootfstype} " \
84 		"${video} ${extrabootargs}\0" \
85 	"nandboot=if run nandloadkernel; then " \
86 			"run nandloadfdt;" \
87 			"run setboottypem;" \
88 			"run storagebootcmd;" \
89 			"run setboottypez;" \
90 			"run storagebootcmd;" \
91 		"fi;\0" \
92 	"run_eboot=echo Starting EBOOT ...; "\
93 		"mmc dev 2 && " \
94 		"mmc rescan && mmc read 10042000 a 400 && go 10042000\0" \
95 	"loadkernel=load ${storagetype} ${storagedev} ${kernel_addr_r} ${kernel};\0"\
96 	"loadfdt=load ${storagetype} ${storagedev} ${fdt_addr_r} ${dtb};\0" \
97 	"nandloadkernel=nand read ${kernel_addr_r} 0 780000;\0" \
98 	"nandloadfdt=nand read ${fdt_addr_r} 780000 80000;\0" \
99 	"setupmmcboot=setenv storagetype mmc; setenv storagedev 2;\0" \
100 	"setupsataboot=setenv storagetype sata; setenv storagedev 0;\0" \
101 	"setupnandboot=setenv storagetype nand;\0" \
102 	"storagebootcmd=echo Booting from ${storagetype} ...;" \
103 			"run ${storagetype}args; run doboot;\0" \
104 	"trybootk=if run loadkernel; then " \
105 		"if ${doloadfdt}; then " \
106 			"run loadfdt;" \
107 		"fi;" \
108 		"run storagebootcmd;" \
109 		"fi;\0" \
110 	"trybootsmz=" \
111 		"run setboottypem;" \
112 		"run trybootk;" \
113 		"run setboottypez;" \
114 		"run trybootk;\0" \
115 	"legacy_bootcmd=" \
116 		"run setupmmcboot;" \
117 		"mmc dev ${storagedev};" \
118 		"if mmc rescan; then " \
119 			"run trybootsmz;" \
120 		"fi;" \
121 		"run setupsataboot;" \
122 		"if sata init; then " \
123 			"run trybootsmz;" \
124 		"fi;" \
125 		"run setupnandboot;" \
126 		"run nandboot;\0" \
127 	"findfdt="\
128 		"if test $board_name = Utilite && test $board_rev = MX6Q ; then " \
129 			"setenv fdtfile imx6q-utilite-pro.dtb; fi; " \
130 		"if test $fdtfile = undefined; then " \
131 			"echo WARNING: Could not determine dtb to use; fi; \0" \
132 	BOOTENV
133 
134 #define BOOT_TARGET_DEVICES(func) \
135 	func(USB, usb, 0) \
136 	func(MMC, mmc, 2) \
137 	func(SATA, sata, 0)
138 
139 #include <config_distro_bootcmd.h>
140 #else
141 #define CONFIG_EXTRA_ENV_SETTINGS
142 #endif
143 
144 /* NAND */
145 #ifndef CONFIG_SPL_BUILD
146 #define CONFIG_SYS_NAND_BASE		0x40000000
147 #define CONFIG_SYS_NAND_MAX_CHIPS	1
148 #define CONFIG_SYS_MAX_NAND_DEVICE	1
149 #define CONFIG_SYS_NAND_ONFI_DETECTION
150 /* APBH DMA is required for NAND support */
151 #endif
152 
153 /* Ethernet */
154 #define CONFIG_FEC_MXC
155 #define CONFIG_FEC_MXC_PHYADDR		0
156 #define CONFIG_FEC_XCV_TYPE		RGMII
157 #define IMX_FEC_BASE			ENET_BASE_ADDR
158 #define CONFIG_ETHPRIME			"FEC0"
159 #define CONFIG_ARP_TIMEOUT		200UL
160 #define CONFIG_NET_RETRY_COUNT		5
161 
162 /* USB */
163 #define CONFIG_MXC_USB_PORTSC		(PORT_PTS_UTMI | PORT_PTS_PTW)
164 #define CONFIG_MXC_USB_FLAGS		0
165 #define CONFIG_USB_MAX_CONTROLLER_COUNT	2
166 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET	/* For OTG port */
167 
168 /* I2C */
169 #define CONFIG_SYS_I2C
170 #define CONFIG_SYS_I2C_MXC
171 #define CONFIG_SYS_I2C_MXC_I2C1		/* enable I2C bus 1 */
172 #define CONFIG_SYS_I2C_MXC_I2C2		/* enable I2C bus 2 */
173 #define CONFIG_SYS_I2C_MXC_I2C3		/* enable I2C bus 3 */
174 #define CONFIG_SYS_I2C_SPEED		100000
175 #define CONFIG_SYS_MXC_I2C3_SPEED	400000
176 
177 #define CONFIG_SYS_I2C_EEPROM_ADDR	0x50
178 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN	1
179 #define CONFIG_SYS_I2C_EEPROM_BUS	2
180 
181 /* SATA */
182 #define CONFIG_SYS_SATA_MAX_DEVICE	1
183 #define CONFIG_LBA48
184 #define CONFIG_DWC_AHSATA_PORT_ID	0
185 #define CONFIG_DWC_AHSATA_BASE_ADDR	SATA_ARB_BASE_ADDR
186 
187 /* Boot */
188 #define CONFIG_SYS_BOOTMAPSZ	        (8 << 20)
189 #define CONFIG_SERIAL_TAG
190 
191 /* misc */
192 #define CONFIG_SYS_MALLOC_LEN			(10 * 1024 * 1024)
193 
194 /* SPL */
195 #include "imx6_spl.h"
196 
197 /* Display */
198 #define CONFIG_IMX_HDMI
199 
200 #define CONFIG_VIDEO_LOGO
201 #define CONFIG_VIDEO_BMP_LOGO
202 
203 /* EEPROM */
204 #define CONFIG_ENV_EEPROM_IS_ON_I2C
205 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN		1
206 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS	4
207 #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS	5
208 #define CONFIG_SYS_EEPROM_SIZE			256
209 
210 #endif	/* __CONFIG_CM_FX6_H */
211