xref: /openbmc/u-boot/include/configs/mccmon6.h (revision eec342ab)
1 /*
2  * Copyright (C) 2016-2017
3  * Lukasz Majewski, DENX Software Engineering, lukma@denx.de
4  *
5  * SPDX-License-Identifier:	GPL-2.0+
6  */
7 
8 #ifndef __CONFIG_H
9 #define __CONFIG_H
10 
11 #include <config_distro_defaults.h>
12 #include "mx6_common.h"
13 
14 #define CONFIG_SPL_LIBCOMMON_SUPPORT
15 #include "imx6_spl.h"
16 
17 #define CONFIG_SPL_BOARD_INIT
18 #define CONFIG_SYS_UBOOT_START CONFIG_SYS_TEXT_BASE
19 #define CONFIG_SYS_UBOOT_BASE (CONFIG_SYS_FLASH_BASE + 0x80000)
20 #define CONFIG_SPL_OS_BOOT
21 #define CONFIG_SYS_OS_BASE (CONFIG_SYS_FLASH_BASE + 0x180000)
22 #define CONFIG_SYS_FDT_BASE (CONFIG_SYS_FLASH_BASE + 0x1980000)
23 #define CONFIG_SYS_FDT_SIZE (48 * SZ_1K)
24 #define CONFIG_SYS_SPL_ARGS_ADDR	0x18000000
25 
26 /*
27  * Below defines are set but NOT really used since we by
28  * design force U-Boot run when we boot in development
29  * mode from SD card (SD2)
30  */
31 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR (0x800)
32 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (0x80)
33 #define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR (0x1000)
34 #define CONFIG_SPL_FS_LOAD_KERNEL_NAME "uImage"
35 #define CONFIG_SPL_FS_LOAD_ARGS_NAME "imx6q-mccmon.dtb"
36 
37 /* Size of malloc() pool */
38 #define CONFIG_SYS_MALLOC_LEN		(10 * SZ_1M)
39 
40 #define CONFIG_BOARD_EARLY_INIT_F
41 #define CONFIG_BOARD_LATE_INIT
42 
43 #define CONFIG_MXC_UART
44 #define CONFIG_MXC_UART_BASE		UART1_BASE
45 
46 #define CONFIG_SYS_MEMTEST_START	0x10000000
47 #define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_MEMTEST_START + 500 * SZ_1M)
48 
49 #define CONFIG_MXC_SPI
50 #define CONFIG_SF_DEFAULT_BUS  2
51 #define CONFIG_SF_DEFAULT_CS   0
52 #define CONFIG_SF_DEFAULT_SPEED 25000000
53 #define CONFIG_SF_DEFAULT_MODE (SPI_MODE_0)
54 
55 /* I2C Configs */
56 #define CONFIG_SYS_I2C
57 #define CONFIG_SYS_I2C_MXC
58 #define CONFIG_SYS_I2C_MXC_I2C1		/* enable I2C bus 1 */
59 #define CONFIG_SYS_I2C_MXC_I2C2		/* enable I2C bus 2 */
60 #define CONFIG_SYS_I2C_SPEED		100000
61 
62 /* MMC Configuration */
63 #define CONFIG_SYS_FSL_USDHC_NUM	2
64 #define CONFIG_SYS_FSL_ESDHC_ADDR	0
65 
66 /* NOR 16-bit mode */
67 #define CONFIG_SYS_FLASH_BASE           WEIM_ARB_BASE_ADDR
68 #define CONFIG_SYS_FLASH_PROTECTION
69 #define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT
70 #define CONFIG_SYS_FLASH_CFI            /* Flash memory is CFI compliant */
71 #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE /* Use buffered writes*/
72 #define CONFIG_SYS_FLASH_EMPTY_INFO
73 #define CONFIG_FLASH_CFI_DRIVER         /* Use drivers/cfi_flash.c */
74 #define CONFIG_FLASH_VERIFY
75 
76 /* NOR Flash MTD */
77 #define CONFIG_FLASH_CFI_DRIVER
78 #define CONFIG_FLASH_CFI_MTD
79 #define CONFIG_SYS_MAX_FLASH_BANKS_DETECT 1
80 #define CONFIG_SYS_FLASH_BANKS_LIST	{ (CONFIG_SYS_FLASH_BASE) }
81 #define CONFIG_SYS_FLASH_BANKS_SIZES	{ (32 * SZ_1M) }
82 
83 /* MTD support */
84 #define CONFIG_CMD_MTDPARTS
85 #define CONFIG_MTD_DEVICE
86 #define CONFIG_MTD_PARTITIONS
87 
88 #define MTDIDS_DEFAULT                  "nor0=8000000.nor"
89 #define MTDPARTS_DEFAULT  \
90 	"mtdparts=8000000.nor:" \
91 	"32m@0x0(mccmon6-image.nor)," \
92 	"256k@0x40000(u-boot-env.nor)," \
93 	"1m@0x80000(u-boot.nor)," \
94 	"8m@0x180000(kernel.nor)," \
95 	"8m@0x980000(swupdate-kernel.nor)," \
96 	"8m@0x1180000(swupdate-rootfs.nor)," \
97 	"128k@0x1980000(kernel-dtb.nor)," \
98 	"128k@0x19C0000(swupdate-kernel-dtb.nor)"
99 
100 /* USB Configs */
101 #define CONFIG_USB_STORAGE
102 #define CONFIG_USB_MAX_CONTROLLER_COUNT	2
103 #define CONFIG_MXC_USB_PORTSC		(PORT_PTS_UTMI | PORT_PTS_PTW)
104 #define CONFIG_MXC_USB_FLAGS		0
105 
106 /* Ethernet Configuration */
107 #define CONFIG_FEC_MXC
108 #define CONFIG_MII
109 #define IMX_FEC_BASE			ENET_BASE_ADDR
110 #define CONFIG_FEC_XCV_TYPE		RGMII
111 #define CONFIG_ETHPRIME			"FEC"
112 #define CONFIG_FEC_MXC_PHYADDR		1
113 #define CONFIG_PHYLIB
114 #define CONFIG_PHY_MICREL
115 #define CONFIG_PHY_MICREL_KSZ9031
116 
117 #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
118 #define CONFIG_EXTRA_ENV_SETTINGS \
119 	"console=ttymxc0,115200 quiet\0" \
120 	"fdtfile=imx6q-mccmon6.dtb\0" \
121 	"fdt_high=0xffffffff\0" \
122 	"initrd_high=0xffffffff\0" \
123 	"boot_os=yes\0" \
124 	"download_kernel=" \
125 		"tftpboot ${kernel_addr} ${kernel_file};" \
126 		"tftpboot ${fdt_addr} ${fdtfile};\0" \
127 	"get_boot_medium=" \
128 		"setenv boot_medium nor;" \
129 		"setexpr.l _src_sbmr1 *0x020d8004;" \
130 		"setexpr _b_medium ${_src_sbmr1} '&' 0x00000040;" \
131 		"if test ${_b_medium} = 40; then " \
132 			"setenv boot_medium sdcard;" \
133 		"fi\0" \
134 	"kernel_file=uImage\0" \
135 	"load_kernel=" \
136 		"load mmc ${bootdev}:${bootpart} ${kernel_addr} uImage;" \
137 		"load mmc ${bootdev}:${bootpart} ${fdt_addr} ${fdtfile};\0" \
138 	"boot_sd=" \
139 		"echo '#######################';" \
140 		"echo '# Factory SDcard Boot #';" \
141 		"echo '#######################';" \
142 		"setenv mmcdev 1;" \
143 		"setenv mmcfactorydev 0;" \
144 		"setenv mmcfactorypart 1;" \
145 		"run factory_flash_img;\0" \
146 	"boot_nor=" \
147 		"setenv kernelnor 0x08180000;" \
148 		"setenv dtbnor 0x09980000;" \
149 		"setenv bootargs console=${console} " \
150 		""MTDPARTS_DEFAULT" " \
151 		"root=/dev/mmcblk1 rootfstype=ext4 rw rootwait noinitrd;" \
152 		"cp.l ${dtbnor} ${dtbloadaddr} 0x8000;" \
153 		"bootm ${kernelnor} - ${dtbloadaddr};\0" \
154 	"boot_recovery=" \
155 		"echo '#######################';" \
156 		"echo '# RECOVERY SWU Boot   #';" \
157 		"echo '#######################';" \
158 		"setenv rootfsloadaddr 0x13000000;" \
159 		"setenv swukernelnor 0x08980000;" \
160 		"setenv swurootfsnor 0x09180000;" \
161 		"setenv swudtbnor 0x099A0000;" \
162 		"setenv bootargs console=${console} " \
163 		""MTDPARTS_DEFAULT" " \
164 		"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
165 		    ":${hostname}::off root=/dev/ram rw;" \
166 		"cp.l ${swurootfsnor} ${rootfsloadaddr} 0x200000;" \
167 		"cp.l ${swudtbnor} ${dtbloadaddr} 0x8000;" \
168 		"bootm ${swukernelnor} ${rootfsloadaddr} ${dtbloadaddr};\0" \
169 	"boot_tftp=" \
170 		"echo '#######################';" \
171 		"echo '# TFTP Boot           #';" \
172 		"echo '#######################';" \
173 		"if run download_kernel; then " \
174 		     "setenv bootargs console=${console} " \
175 		     "root=/dev/mmcblk0p2 rootwait;" \
176 		     "bootm ${kernel_addr} - ${fdt_addr};" \
177 		"fi\0" \
178 	"bootcmd=" \
179 		"if test -n ${recovery_status}; then " \
180 		     "run boot_recovery;" \
181 		"else " \
182 		     "if test ! -n ${boot_medium}; then " \
183 			  "run get_boot_medium;" \
184 			  "if test ${boot_medium} = sdcard; then " \
185 			      "run boot_sd;" \
186 			  "else " \
187 			      "run boot_nor;" \
188 			  "fi;" \
189 		     "else " \
190 			  "if test ${boot_medium} = tftp; then " \
191 			      "run boot_tftp;" \
192 			  "fi;" \
193 		     "fi;" \
194 		"fi\0" \
195 	"mtdparts=" MTDPARTS_DEFAULT "\0" \
196 	"fdt_addr=0x18000000\0" \
197 	"bootdev=1\0" \
198 	"bootpart=1\0" \
199 	"kernel_addr=" __stringify(CONFIG_LOADADDR) "\0" \
200 	"netdev=eth0\0" \
201 	"load_addr=0x11000000\0" \
202 	"dtbloadaddr=0x12000000\0" \
203 	"uboot_file=u-boot.img\0" \
204 	"SPL_file=SPL\0" \
205 	"load_uboot=tftp ${load_addr} ${uboot_file}\0" \
206 	"nor_img_addr=0x11000000\0" \
207 	"nor_img_file=core-image-lwn-mccmon6.nor\0" \
208 	"emmc_img_file=core-image-lwn-mccmon6.ext4\0" \
209 	"nor_bank_start=" __stringify(CONFIG_SYS_FLASH_BASE) "\0" \
210 	"nor_img_size=0x02000000\0" \
211 	"factory_script_file=factory.scr\0" \
212 	"factory_load_script=" \
213 		"if test -e mmc ${mmcdev}:${mmcfactorypart} " \
214 		    "${factory_script_file}; then " \
215 		    "load mmc ${mmcdev}:${mmcfactorypart} " \
216 		     "${loadaddr} ${factory_script_file};" \
217 		"fi\0" \
218 	"factory_script=echo Running factory script from mmc${mmcdev} ...; " \
219 		"source ${loadaddr}\0" \
220 	"factory_flash_img="\
221 		"echo 'Flash mccmon6 with factory images'; " \
222 		"if run factory_load_script; then " \
223 			"run factory_script;" \
224 		"else " \
225 		    "echo No factory script: ${factory_script_file} found on " \
226 		    "device ${mmcdev};" \
227 		    "run factory_nor_img;" \
228 		    "run factory_eMMC_img;" \
229 		"fi\0" \
230 	"factory_eMMC_img="\
231 		"echo 'Update mccmon6 eMMC image'; " \
232 		"if load mmc ${mmcdev}:${mmcfactorypart} " \
233 		    "${loadaddr} ${emmc_img_file}; then " \
234 		    "setexpr fw_sz ${filesize} / 0x200;" \
235 		    "setexpr fw_sz ${fw_sz} + 1;" \
236 		    "mmc dev ${mmcfactorydev};" \
237 		    "mmc write ${loadaddr} 0x0 ${fw_sz};" \
238 		"fi\0" \
239 	"factory_nor_img="\
240 		"echo 'Update mccmon6 NOR image'; " \
241 		"if load mmc ${mmcdev}:${mmcfactorypart} " \
242 		    "${nor_img_addr} ${nor_img_file}; then " \
243 			"run nor_update;" \
244 		"fi\0" \
245 	"nor_update=" \
246 		    "protect off ${nor_bank_start} +${nor_img_size};" \
247 		    "erase ${nor_bank_start} +${nor_img_size};" \
248 		    "setexpr nor_img_size ${nor_img_size} / 4; " \
249 		    "cp.l ${nor_img_addr} ${nor_bank_start} ${nor_img_size}\0" \
250 	"tftp_nor_uboot="\
251 		"echo 'Update mccmon6 NOR U-BOOT via TFTP'; " \
252 		"setenv nor_img_file u-boot.img; " \
253 		"setenv nor_img_size 0x80000; " \
254 		"setenv nor_bank_start 0x08080000; " \
255 		"if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
256 		    "run nor_update;" \
257 		"fi\0" \
258 	"tftp_nor_uImg="\
259 		"echo 'Update mccmon6 NOR uImage via TFTP'; " \
260 		"setenv nor_img_file uImage; " \
261 		"setenv nor_img_size 0x500000; " \
262 		"setenv nor_bank_start 0x08180000; " \
263 		"if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
264 		    "run nor_update;" \
265 		"fi\0" \
266 	"tftp_nor_dtb="\
267 		"echo 'Update mccmon6 NOR DTB via TFTP'; " \
268 		"setenv nor_img_file imx6q-mccmon6.dtb; " \
269 		"setenv nor_img_size 0x20000; " \
270 		"setenv nor_bank_start 0x09980000; " \
271 		"if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
272 		    "run nor_update;" \
273 		"fi\0" \
274 	"tftp_nor_img="\
275 		"echo 'Update mccmon6 NOR image via TFTP'; " \
276 		"if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
277 		    "run nor_update;" \
278 		"fi\0" \
279 	"tftp_nor_SPL="\
280 		"if tftp ${load_addr} SPL_padded; then " \
281 		    "erase 0x08000000 +0x20000;" \
282 		    "cp.b ${load_addr} 0x08000000 0x20000;" \
283 		"fi;\0" \
284 	"tftp_sd_SPL="\
285 	    "if mmc dev 1; then "      \
286 		"if tftp ${load_addr} ${SPL_file}; then " \
287 		    "setexpr fw_sz ${filesize} / 0x200; " \
288 		    "setexpr fw_sz ${fw_sz} + 1; " \
289 		    "mmc write ${load_addr} 0x2 ${fw_sz};" \
290 		"fi;" \
291 	    "fi;\0" \
292 	"tftp_sd_uboot="\
293 	    "if mmc dev 1; then "      \
294 		"if run load_uboot; then " \
295 		    "setexpr fw_sz ${filesize} / 0x200; " \
296 		    "setexpr fw_sz ${fw_sz} + 1; " \
297 		    "mmc write ${load_addr} 0x8A ${fw_sz};" \
298 		"fi;" \
299 	    "fi;\0"
300 
301 /* Physical Memory Map */
302 #define CONFIG_NR_DRAM_BANKS		1
303 #define PHYS_SDRAM			MMDC0_ARB_BASE_ADDR
304 
305 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM
306 #define CONFIG_SYS_INIT_RAM_ADDR	IRAM_BASE_ADDR
307 #define CONFIG_SYS_INIT_RAM_SIZE	IRAM_SIZE
308 
309 #define CONFIG_SYS_INIT_SP_OFFSET \
310 	(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
311 #define CONFIG_SYS_INIT_SP_ADDR \
312 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
313 
314 /* Environment organization */
315 #define CONFIG_ENV_SIZE			(SZ_128K)
316 
317 /* Envs are stored in NOR flash */
318 #define CONFIG_ENV_IS_IN_FLASH
319 #define CONFIG_ENV_SECT_SIZE    (SZ_128K)
320 #define CONFIG_ENV_ADDR	(CONFIG_SYS_FLASH_BASE + 0x40000)
321 
322 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
323 #define CONFIG_ENV_ADDR_REDUND	(CONFIG_SYS_FLASH_BASE + 0x60000)
324 #define CONFIG_ENV_SIZE_REDUND	CONFIG_ENV_SIZE
325 
326 #endif			       /* __CONFIG_H * */
327