1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2016 Freescale Semiconductor, Inc.
4  *
5  * Configuration settings for the Freescale i.MX6UL 14x14 EVK board.
6  */
7 #ifndef __MX6ULLEVK_CONFIG_H
8 #define __MX6ULLEVK_CONFIG_H
9 
10 
11 #include <asm/arch/imx-regs.h>
12 #include <linux/sizes.h>
13 #include <linux/stringify.h>
14 #include "mx6_common.h"
15 #include <asm/mach-imx/gpio.h>
16 
17 #define PHYS_SDRAM_SIZE	SZ_512M
18 
19 /* Size of malloc() pool */
20 #define CONFIG_SYS_MALLOC_LEN		(16 * SZ_1M)
21 
22 #define CONFIG_MXC_UART_BASE		UART1_BASE
23 
24 /* MMC Configs */
25 #ifdef CONFIG_FSL_USDHC
26 #define CONFIG_SYS_FSL_ESDHC_ADDR	USDHC2_BASE_ADDR
27 
28 /* NAND pin conflicts with usdhc2 */
29 #ifdef CONFIG_SYS_USE_NAND
30 #define CONFIG_SYS_FSL_USDHC_NUM	1
31 #else
32 #define CONFIG_SYS_FSL_USDHC_NUM	2
33 #endif
34 #endif
35 
36 /* I2C configs */
37 #ifdef CONFIG_CMD_I2C
38 #define CONFIG_SYS_I2C_MXC
39 #define CONFIG_SYS_I2C_MXC_I2C1		/* enable I2C bus 1 */
40 #define CONFIG_SYS_I2C_MXC_I2C2		/* enable I2C bus 2 */
41 #define CONFIG_SYS_I2C_SPEED		100000
42 #endif
43 
44 #define CONFIG_SYS_MMC_IMG_LOAD_PART	1
45 
46 #define CONFIG_EXTRA_ENV_SETTINGS \
47 	"script=boot.scr\0" \
48 	"image=zImage\0" \
49 	"console=ttymxc0\0" \
50 	"fdt_high=0xffffffff\0" \
51 	"initrd_high=0xffffffff\0" \
52 	"fdt_file=undefined\0" \
53 	"fdt_addr=0x83000000\0" \
54 	"boot_fdt=try\0" \
55 	"ip_dyn=yes\0" \
56 	"videomode=video=ctfb:x:480,y:272,depth:24,pclk:108695,le:8,ri:4,up:2,lo:4,hs:41,vs:10,sync:0,vmode:0\0" \
57 	"mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
58 	"mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
59 	"mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
60 	"mmcautodetect=yes\0" \
61 	"mmcargs=setenv bootargs console=${console},${baudrate} " \
62 		"root=${mmcroot}\0" \
63 	"loadbootscript=" \
64 		"fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
65 	"bootscript=echo Running bootscript from mmc ...; " \
66 		"source\0" \
67 	"loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
68 	"loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
69 	"mmcboot=echo Booting from mmc ...; " \
70 		"run mmcargs; " \
71 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
72 			"if run loadfdt; then " \
73 				"bootz ${loadaddr} - ${fdt_addr}; " \
74 			"else " \
75 				"if test ${boot_fdt} = try; then " \
76 					"bootz; " \
77 				"else " \
78 					"echo WARN: Cannot load the DT; " \
79 				"fi; " \
80 			"fi; " \
81 		"else " \
82 			"bootz; " \
83 		"fi;\0" \
84 		"findfdt="\
85 			"if test $fdt_file = undefined; then " \
86 				"if test $board_name = ULZ-EVK && test $board_rev = 14X14; then " \
87 					"setenv fdt_file imx6ulz-14x14-evk.dtb; fi; " \
88 				"if test $board_name = EVK && test $board_rev = 14X14; then " \
89 					"setenv fdt_file imx6ull-14x14-evk.dtb; fi; " \
90 				"if test $fdt_file = undefined; then " \
91 					"echo WARNING: Could not determine dtb to use; " \
92 				"fi; " \
93 			"fi;\0" \
94 	"netargs=setenv bootargs console=${console},${baudrate} " \
95 		"root=/dev/nfs " \
96 	"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
97 		"netboot=echo Booting from net ...; " \
98 		"run netargs; " \
99 		"if test ${ip_dyn} = yes; then " \
100 			"setenv get_cmd dhcp; " \
101 		"else " \
102 			"setenv get_cmd tftp; " \
103 		"fi; " \
104 		"${get_cmd} ${image}; " \
105 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
106 			"if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
107 				"bootz ${loadaddr} - ${fdt_addr}; " \
108 			"else " \
109 				"if test ${boot_fdt} = try; then " \
110 					"bootz; " \
111 				"else " \
112 					"echo WARN: Cannot load the DT; " \
113 				"fi; " \
114 			"fi; " \
115 		"else " \
116 			"bootz; " \
117 		"fi;\0" \
118 
119 #define CONFIG_BOOTCOMMAND \
120 	   "run findfdt;" \
121 	   "mmc dev ${mmcdev};" \
122 	   "mmc dev ${mmcdev}; if mmc rescan; then " \
123 		   "if run loadbootscript; then " \
124 			   "run bootscript; " \
125 		   "else " \
126 			   "if run loadimage; then " \
127 				   "run mmcboot; " \
128 			   "else run netboot; " \
129 			   "fi; " \
130 		   "fi; " \
131 	   "else run netboot; fi"
132 
133 /* Miscellaneous configurable options */
134 
135 #define CONFIG_SYS_LOAD_ADDR		CONFIG_LOADADDR
136 #define CONFIG_SYS_HZ			1000
137 
138 /* Physical Memory Map */
139 #define PHYS_SDRAM			MMDC0_ARB_BASE_ADDR
140 
141 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM
142 #define CONFIG_SYS_INIT_RAM_ADDR	IRAM_BASE_ADDR
143 #define CONFIG_SYS_INIT_RAM_SIZE	IRAM_SIZE
144 
145 #define CONFIG_SYS_INIT_SP_OFFSET \
146 	(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
147 #define CONFIG_SYS_INIT_SP_ADDR \
148 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
149 
150 /* environment organization */
151 #define CONFIG_MMCROOT			"/dev/mmcblk1p2"  /* USDHC2 */
152 
153 #define CONFIG_IOMUX_LPSR
154 
155 #define CONFIG_SOFT_SPI
156 
157 #ifdef CONFIG_CMD_NET
158 #define CONFIG_FEC_ENET_DEV		1
159 #if (CONFIG_FEC_ENET_DEV == 0)
160 #define CONFIG_ETHPRIME			"eth0"
161 #elif (CONFIG_FEC_ENET_DEV == 1)
162 #define CONFIG_ETHPRIME			"eth1"
163 #endif
164 #endif
165 
166 #endif
167