1 /*
2  * Copyright 2016 Toradex AG
3  *
4  * Configuration settings for the Colibri iMX7 module.
5  *
6  * based on mx7dsabresd.h:
7  * Copyright (C) 2015 Freescale Semiconductor, Inc.
8  *
9  * SPDX-License-Identifier:	GPL-2.0+
10  */
11 
12 #ifndef __COLIBRI_IMX7_CONFIG_H
13 #define __COLIBRI_IMX7_CONFIG_H
14 
15 #include "mx7_common.h"
16 
17 #define CONFIG_SYS_THUMB_BUILD
18 #define CONFIG_USE_ARCH_MEMCPY
19 #define CONFIG_USE_ARCH_MEMSET
20 
21 /*#define CONFIG_DBG_MONITOR*/
22 #define PHYS_SDRAM_SIZE			SZ_512M
23 
24 #define CONFIG_BOARD_EARLY_INIT_F
25 #define CONFIG_BOARD_LATE_INIT
26 
27 #define CONFIG_DISPLAY_BOARDINFO_LATE
28 
29 /* Size of malloc() pool */
30 #define CONFIG_SYS_MALLOC_LEN		(32 * SZ_1M)
31 
32 /* Uncomment to enable secure boot support */
33 /* #define CONFIG_SECURE_BOOT */
34 #define CONFIG_CSF_SIZE			0x4000
35 
36 #define CONFIG_CMD_BMODE
37 
38 /* Network */
39 #define CONFIG_FEC_MXC
40 #define CONFIG_MII
41 #define CONFIG_FEC_XCV_TYPE             RMII
42 #define CONFIG_ETHPRIME                 "FEC"
43 #define CONFIG_FEC_MXC_PHYADDR          0
44 
45 #define CONFIG_PHYLIB
46 #define CONFIG_PHY_MICREL
47 #define CONFIG_TFTP_TSIZE
48 #define CONFIG_IP_DEFRAG
49 #define CONFIG_TFTP_BLOCKSIZE		16384
50 
51 /* ENET1 */
52 #define IMX_FEC_BASE			ENET_IPS_BASE_ADDR
53 
54 /* MMC Config*/
55 #define CONFIG_SYS_FSL_ESDHC_ADDR	0
56 #define CONFIG_SYS_FSL_USDHC_NUM	1
57 
58 #undef CONFIG_BOOTM_PLAN9
59 #undef CONFIG_BOOTM_RTEMS
60 
61 /* I2C configs */
62 #define CONFIG_SYS_I2C
63 #define CONFIG_SYS_I2C_MXC
64 #define CONFIG_SYS_I2C_MXC_I2C1		/* enable I2C bus 1 */
65 #define CONFIG_SYS_I2C_SPEED		100000
66 
67 #define CONFIG_IPADDR			192.168.10.2
68 #define CONFIG_NETMASK			255.255.255.0
69 #define CONFIG_SERVERIP			192.168.10.1
70 
71 #define MEM_LAYOUT_ENV_SETTINGS \
72 	"fdt_addr_r=0x82000000\0" \
73 	"fdt_high=0xffffffff\0" \
74 	"initrd_high=0xffffffff\0" \
75 	"kernel_addr_r=0x81000000\0" \
76 	"ramdisk_addr_r=0x82100000\0"
77 
78 #define SD_BOOTCMD \
79 	"sdargs=root=/dev/mmcblk0p2 rw rootwait\0"	\
80 	"sdboot=run setup; setenv bootargs ${defargs} ${sdargs} " \
81 	"${setupargs} ${vidargs}; echo Booting from MMC/SD card...; " \
82 	"run m4boot && " \
83 	"load mmc 0:1 ${kernel_addr_r} ${kernel_file} && " \
84 	"load mmc 0:1 ${fdt_addr_r} ${soc}-colibri-${fdt_board}.dtb && " \
85 	"run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
86 
87 #define NFS_BOOTCMD \
88 	"nfsargs=ip=:::::eth0: root=/dev/nfs\0"	\
89 	"nfsboot=run setup; " \
90 		"setenv bootargs ${defargs} ${nfsargs} " \
91 		"${setupargs} ${vidargs}; echo Booting from NFS...;" \
92 		"dhcp ${kernel_addr_r} && "	\
93 		"tftp ${fdt_addr_r} ${soc}-colibri-${fdt_board}.dtb && " \
94 		"run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
95 
96 #define UBI_BOOTCMD	\
97 	"ubiargs=ubi.mtd=ubi root=ubi0:rootfs rootfstype=ubifs " \
98 		"ubi.fm_autoconvert=1\0" \
99 	"ubiboot=run setup; " \
100 		"setenv bootargs ${defargs} ${ubiargs} " \
101 		"${setupargs} ${vidargs}; echo Booting from NAND...; " \
102 		"ubi part ubi && run m4boot && " \
103 		"ubi read ${kernel_addr_r} kernel && " \
104 		"ubi read ${fdt_addr_r} dtb && " \
105 		"run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
106 
107 #define CONFIG_BOOTCOMMAND "run ubiboot; run sdboot; run nfsboot"
108 
109 #define CONFIG_EXTRA_ENV_SETTINGS \
110 	MEM_LAYOUT_ENV_SETTINGS \
111 	NFS_BOOTCMD \
112 	SD_BOOTCMD \
113 	UBI_BOOTCMD \
114 	"console=ttymxc0\0" \
115 	"defargs=\0" \
116 	"fdt_board=eval-v3\0" \
117 	"fdt_fixup=;\0" \
118 	"m4boot=;\0" \
119 	"ip_dyn=yes\0" \
120 	"kernel_file=zImage\0" \
121 	"mtdparts=" MTDPARTS_DEFAULT "\0" \
122 	"setethupdate=if env exists ethaddr; then; else setenv ethaddr " \
123 		"00:14:2d:00:00:00; fi; tftpboot ${loadaddr} " \
124 		"${board}/flash_eth.img && source ${loadaddr}\0" \
125 	"setsdupdate=mmc rescan && setenv interface mmc && " \
126 		"fatload ${interface} 0:1 ${loadaddr} " \
127 		"${board}/flash_blk.img && source ${loadaddr}\0" \
128 	"setup=setenv setupargs " \
129 		"console=tty1 console=${console}" \
130 		",${baudrate}n8 ${memargs} consoleblank=0 ${mtdparts}\0" \
131 	"setupdate=run setsdupdate || run setusbupdate || run setethupdate\0" \
132 	"setusbupdate=usb start && setenv interface usb && " \
133 		"fatload ${interface} 0:1 ${loadaddr} " \
134 		"${board}/flash_blk.img && source ${loadaddr}\0" \
135 	"splashpos=m,m\0" \
136 	"videomode=video=ctfb:x:640,y:480,depth:18,pclk:39722,le:48,ri:16,up:33,lo:10,hs:96,vs:2,sync:0,vmode:0\0" \
137 
138 /* Miscellaneous configurable options */
139 #define CONFIG_SYS_LONGHELP
140 
141 #define CONFIG_SYS_MEMTEST_START	0x80000000
142 #define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_MEMTEST_START + 0x0c000000)
143 
144 #define CONFIG_SYS_LOAD_ADDR		CONFIG_LOADADDR
145 #define CONFIG_SYS_HZ			1000
146 
147 #define CONFIG_STACKSIZE		SZ_128K
148 
149 /* Physical Memory Map */
150 #define CONFIG_NR_DRAM_BANKS		1
151 #define PHYS_SDRAM			MMDC0_ARB_BASE_ADDR
152 
153 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM
154 #define CONFIG_SYS_INIT_RAM_ADDR	IRAM_BASE_ADDR
155 #define CONFIG_SYS_INIT_RAM_SIZE	IRAM_SIZE
156 
157 #define CONFIG_SYS_INIT_SP_OFFSET \
158 	(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
159 #define CONFIG_SYS_INIT_SP_ADDR \
160 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
161 
162 /* FLASH and environment organization */
163 #define CONFIG_SYS_NO_FLASH
164 #define CONFIG_ENV_IS_IN_NAND
165 
166 #if defined(CONFIG_ENV_IS_IN_MMC)
167 #define CONFIG_SYS_MMC_ENV_DEV		0   /* USDHC1 */
168 #define CONFIG_SYS_MMC_ENV_PART		0	/* user area */
169 #define CONFIG_MMCROOT			"/dev/mmcblk0p2"  /* USDHC1 */
170 #define CONFIG_ENV_OFFSET		(8 * SZ_64K)
171 #elif defined(CONFIG_ENV_IS_IN_NAND)
172 #define CONFIG_ENV_OFFSET		(4 * 1024 * 1024)
173 #define CONFIG_ENV_SECT_SIZE		(128 * 1024)
174 #define CONFIG_ENV_SIZE			CONFIG_ENV_SECT_SIZE
175 #endif
176 
177 #define CONFIG_NAND_MXS
178 #define CONFIG_CMD_NAND_TRIMFFS
179 
180 /* NAND stuff */
181 #define CONFIG_SYS_MAX_NAND_DEVICE	1
182 #define CONFIG_SYS_NAND_BASE		0x40000000
183 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
184 #define CONFIG_SYS_NAND_ONFI_DETECTION
185 #define CONFIG_SYS_NAND_MX7_GPMI_62_ECC_BYTES
186 #define CONFIG_CMD_NAND_TORTURE
187 
188 /* UBI stuff */
189 #define CONFIG_RBTREE
190 #define CONFIG_LZO
191 #define CONFIG_CMD_UBI
192 #define CONFIG_MTD_UBI_FASTMAP
193 #define CONFIG_CMD_UBIFS	/* increases size by almost 60 KB */
194 
195 /* Dynamic MTD partition support */
196 #define CONFIG_CMD_MTDPARTS	/* Enable 'mtdparts' command line support */
197 #define CONFIG_MTD_PARTITIONS
198 #define CONFIG_MTD_DEVICE	/* needed for mtdparts commands */
199 #define MTDIDS_DEFAULT		"nand0=gpmi-nand"
200 #define MTDPARTS_DEFAULT	"mtdparts=gpmi-nand:"		\
201 				"512k(mx7-bcb),"		\
202 				"3584k(u-boot)ro,"		\
203 				"512k(u-boot-env),"		\
204 				"-(ubi)"
205 
206 /* DMA stuff, needed for GPMI/MXS NAND support */
207 #define CONFIG_APBH_DMA
208 #define CONFIG_APBH_DMA_BURST
209 #define CONFIG_APBH_DMA_BURST8
210 
211 /* USB Configs */
212 #define CONFIG_USB_STORAGE
213 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
214 
215 #define CONFIG_MXC_USB_PORTSC		(PORT_PTS_UTMI | PORT_PTS_PTW)
216 #define CONFIG_MXC_USB_FLAGS		0
217 #define CONFIG_USB_MAX_CONTROLLER_COUNT 2
218 
219 #define CONFIG_IMX_THERMAL
220 
221 #define CONFIG_USBD_HS
222 
223 #define CONFIG_USB_FUNCTION_MASS_STORAGE
224 
225 /* USB Device Firmware Update support */
226 #define CONFIG_USB_FUNCTION_DFU
227 #define CONFIG_DFU_MMC
228 #define CONFIG_SYS_DFU_DATA_BUF_SIZE	SZ_16M
229 #define DFU_DEFAULT_POLL_TIMEOUT	300
230 
231 #define CONFIG_VIDEO
232 #ifdef CONFIG_VIDEO
233 #define CONFIG_CFB_CONSOLE
234 #define CONFIG_VIDEO_MXS
235 #define CONFIG_VIDEO_LOGO
236 #define CONFIG_VIDEO_SW_CURSOR
237 #define CONFIG_VGA_AS_SINGLE_DEVICE
238 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
239 #define CONFIG_SPLASH_SCREEN
240 #define CONFIG_SPLASH_SCREEN_ALIGN
241 #define CONFIG_CMD_BMP
242 #define CONFIG_BMP_16BPP
243 #define CONFIG_VIDEO_BMP_RLE8
244 #define CONFIG_VIDEO_BMP_LOGO
245 #endif
246 
247 #endif
248