1 /*
2  * (C) Copyright 2015
3  * (C) Copyright 2014
4  * Heiko Schocher, DENX Software Engineering, hs@denx.de.
5  *
6  * Based on:
7  * Copyright (C) 2012 Freescale Semiconductor, Inc.
8  *
9  * Configuration settings for the Freescale i.MX6Q SabreSD board.
10  *
11  * SPDX-License-Identifier:	GPL-2.0+
12  */
13 #ifndef __ARISTAINETOS_COMMON_CONFIG_H
14 #define __ARISTAINETOS_COMMON_CONFIG_H
15 
16 #include "mx6_common.h"
17 
18 #define CONFIG_MACH_TYPE	4501
19 #define CONFIG_MMCROOT		"/dev/mmcblk0p1"
20 
21 /* Size of malloc() pool */
22 #define CONFIG_SYS_MALLOC_LEN		(64 * SZ_1M)
23 
24 #define CONFIG_MXC_UART
25 
26 /* MMC Configs */
27 #define CONFIG_SYS_FSL_ESDHC_ADDR      0
28 
29 #define CONFIG_FEC_MXC
30 #define CONFIG_MII
31 #define IMX_FEC_BASE			ENET_BASE_ADDR
32 #define CONFIG_ETHPRIME			"FEC"
33 #define CONFIG_FEC_MXC_PHYADDR		0
34 
35 #define CONFIG_SPI_FLASH_MTD
36 #define CONFIG_SF_DEFAULT_SPEED		20000000
37 #define CONFIG_SF_DEFAULT_MODE		SPI_MODE_0
38 #define CONFIG_SYS_SPI_ST_ENABLE_WP_PIN
39 
40 #define CONFIG_EXTRA_ENV_SETTINGS \
41 	"script=u-boot.scr\0" \
42 	"fit_file=/boot/system.itb\0" \
43 	"loadaddr=0x12000000\0" \
44 	"fit_addr_r=0x14000000\0" \
45 	"uboot=/boot/u-boot.imx\0" \
46 	"uboot_sz=d0000\0" \
47 	"rescue_sys_addr=f0000\0" \
48 	"rescue_sys_length=f10000\0" \
49 	"panel=lb07wv8\0" \
50 	"splashpos=m,m\0" \
51 	"console=" CONSOLE_DEV "\0" \
52 	"fdt_high=0xffffffff\0"	  \
53 	"initrd_high=0xffffffff\0" \
54 	"addmtd=setenv bootargs ${bootargs} ${mtdparts}\0" \
55 	"set_fit_default=fdt addr ${fit_addr_r};fdt set /configurations " \
56 		"default ${board_type}\0" \
57 	"get_env=mw ${loadaddr} 0 0x20000;" \
58 		"mmc rescan;" \
59 		"ext2load mmc ${mmcdev}:${mmcpart} ${loadaddr} env.txt;" \
60 		"env import -t ${loadaddr}\0" \
61 	"default_env=mw ${loadaddr} 0 0x20000;" \
62 		"env export -t ${loadaddr} serial# ethaddr eth1addr " \
63 		"board_type panel;" \
64 		"env default -a;" \
65 		"env import -t ${loadaddr}\0" \
66 	"loadbootscript=" \
67 		"ext2load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
68 	"bootscript=echo Running bootscript from mmc ...; " \
69 		"source\0" \
70 	"mmcpart=1\0" \
71 	"mmcdev=0\0" \
72 	"mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
73 	"mmcargs=setenv bootargs console=${console},${baudrate} " \
74 		"root=${mmcroot}\0" \
75 	"mmcboot=echo Booting from mmc ...; " \
76 		"run mmcargs addmtd addmisc set_fit_default;" \
77 		"bootm ${fit_addr_r}\0" \
78 	"mmc_load_fit=ext2load mmc ${mmcdev}:${mmcpart} ${fit_addr_r} " \
79 		"${fit_file}\0" \
80 	"mmc_load_uboot=ext2load mmc ${mmcdev}:${mmcpart} ${loadaddr} " \
81 		"${uboot}\0" \
82 	"mmc_upd_uboot=mw.b ${loadaddr} 0xff ${uboot_sz};" \
83 		"setexpr cmp_buf ${loadaddr} + ${uboot_sz};" \
84 		"setexpr uboot_maxsize ${uboot_sz} - 400;" \
85 		"mw.b ${cmp_buf} 0x00 ${uboot_sz};" \
86 		"run mmc_load_uboot;sf probe;sf erase 0 ${uboot_sz};" \
87 		"sf write ${loadaddr} 400 ${filesize};" \
88 		"sf read ${cmp_buf} 400 ${uboot_sz};" \
89 		"cmp.b ${loadaddr} ${cmp_buf} ${uboot_maxsize}\0" \
90 	"ubiboot=echo Booting from ubi ...; " \
91 		"run ubiargs addmtd addmisc set_fit_default;" \
92 		"bootm ${fit_addr_r}\0" \
93 	"rescueargs=setenv bootargs console=${console},${baudrate} " \
94 		"root=/dev/ram rw\0 " \
95 	"rescueboot=echo Booting rescue system from NOR ...; " \
96 		"run rescueargs addmtd addmisc set_fit_default;" \
97 		"bootm ${fit_addr_r}\0" \
98 	"rescue_load_fit=sf probe;sf read ${fit_addr_r} ${rescue_sys_addr} " \
99 		"${rescue_sys_length}; imi ${fit_addr_r}\0" \
100 	CONFIG_EXTRA_ENV_BOARD_SETTINGS
101 
102 #define CONFIG_BOOTCOMMAND \
103 	"mmc dev ${mmcdev};" \
104 	"if mmc rescan; then " \
105 		"if run loadbootscript; then " \
106 			"run bootscript; " \
107 		"else " \
108 			"if run mmc_load_fit; then " \
109 				"run mmcboot; " \
110 			"else " \
111 				"if run ubifs_load_fit; then " \
112 					"run ubiboot; " \
113 				"else " \
114 					"if run rescue_load_fit; then " \
115 						"run rescueboot; " \
116 					"else " \
117 						"echo RESCUE SYSTEM BOOT " \
118 							"FAILURE;" \
119 					"fi; " \
120 				"fi; " \
121 			"fi; " \
122 		"fi; " \
123 	"else " \
124 		"if run ubifs_load_fit; then " \
125 			"run ubiboot; " \
126 		"else " \
127 			"if run rescue_load_fit; then " \
128 				"run rescueboot; " \
129 			"else " \
130 				"echo RESCUE SYSTEM BOOT FAILURE;" \
131 			"fi; " \
132 		"fi; " \
133 	"fi"
134 
135 #define CONFIG_ARP_TIMEOUT		200UL
136 
137 #define CONFIG_SYS_MEMTEST_START	PHYS_SDRAM
138 #define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_MEMTEST_START + 0x100000)
139 #define CONFIG_SYS_MEMTEST_SCRATCH	0x10800000
140 
141 /* Physical Memory Map */
142 #define CONFIG_NR_DRAM_BANKS		1
143 #define PHYS_SDRAM			MMDC0_ARB_BASE_ADDR
144 
145 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM
146 #define CONFIG_SYS_INIT_RAM_ADDR	IRAM_BASE_ADDR
147 #define CONFIG_SYS_INIT_RAM_SIZE	IRAM_SIZE
148 
149 #define CONFIG_SYS_INIT_SP_OFFSET \
150 	(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
151 #define CONFIG_SYS_INIT_SP_ADDR \
152 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
153 
154 /* Environment organization */
155 #define CONFIG_ENV_SIZE			(12 * 1024)
156 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
157 #define CONFIG_ENV_SPI_BUS		CONFIG_SF_DEFAULT_BUS
158 #define CONFIG_ENV_SPI_CS		CONFIG_SF_DEFAULT_CS
159 #define CONFIG_ENV_SPI_MAX_HZ		CONFIG_SF_DEFAULT_SPEED
160 #define CONFIG_ENV_SPI_MODE		CONFIG_SF_DEFAULT_MODE
161 #define CONFIG_ENV_SECT_SIZE		(0x010000)
162 #define CONFIG_ENV_OFFSET		(0x0d0000)
163 #define CONFIG_ENV_OFFSET_REDUND	(0x0e0000)
164 
165 #define CONFIG_SYS_FSL_USDHC_NUM	2
166 
167 /* I2C */
168 #define CONFIG_SYS_I2C
169 #define CONFIG_SYS_I2C_MXC
170 #define CONFIG_SYS_I2C_MXC_I2C1		/* enable I2C bus 1 */
171 #define CONFIG_SYS_I2C_MXC_I2C2		/* enable I2C bus 2 */
172 #define CONFIG_SYS_I2C_MXC_I2C3		/* enable I2C bus 3 */
173 #define CONFIG_SYS_I2C_SPEED		100000
174 #define CONFIG_SYS_I2C_SLAVE		0x7f
175 #define CONFIG_SYS_I2C_NOPROBES		{ {0, 0x00} }
176 
177 /* NAND stuff */
178 #define CONFIG_SYS_MAX_NAND_DEVICE	1
179 #define CONFIG_SYS_NAND_BASE		0x40000000
180 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
181 #define CONFIG_SYS_NAND_ONFI_DETECTION
182 
183 /* DMA stuff, needed for GPMI/MXS NAND support */
184 
185 /* RTC */
186 #define CONFIG_SYS_I2C_RTC_ADDR	0x68
187 #define CONFIG_SYS_RTC_BUS_NUM	2
188 #define CONFIG_RTC_M41T11
189 
190 /* USB Configs */
191 #define CONFIG_USB_MAX_CONTROLLER_COUNT 2
192 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET	/* For OTG port */
193 #define CONFIG_MXC_USB_PORTSC	(PORT_PTS_UTMI | PORT_PTS_PTW)
194 #define CONFIG_MXC_USB_FLAGS	0
195 
196 /* UBI support */
197 #define CONFIG_MTD_PARTITIONS
198 #define CONFIG_MTD_DEVICE
199 
200 #define CONFIG_HW_WATCHDOG
201 #define CONFIG_IMX_WATCHDOG
202 
203 /* Framebuffer */
204 #define CONFIG_VIDEO_IPUV3
205 /* check this console not needed, after test remove it */
206 #define CONFIG_VIDEO_BMP_RLE8
207 #define CONFIG_SPLASH_SCREEN
208 #define CONFIG_SPLASH_SCREEN_ALIGN
209 #define CONFIG_BMP_16BPP
210 #define CONFIG_VIDEO_LOGO
211 #define CONFIG_VIDEO_BMP_LOGO
212 #define CONFIG_IMX_VIDEO_SKIP
213 
214 #define CONFIG_PWM_IMX
215 #define CONFIG_IMX6_PWM_PER_CLK	66000000
216 
217 #endif /* __ARISTAINETOS_COMMON_CONFIG_H */
218