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