1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2014, Barco (www.barco.com)
4  */
5 
6 #ifndef __PLATINUM_CONFIG_H__
7 #define __PLATINUM_CONFIG_H__
8 
9 /* SPL */
10 
11 /* Location in NAND to read U-Boot from */
12 #define CONFIG_SYS_NAND_U_BOOT_OFFS     (14 * 1024 * 1024)
13 
14 #include "imx6_spl.h"                  /* common IMX6 SPL configuration */
15 #include "mx6_common.h"
16 
17 /*
18  * Hardware configuration
19  */
20 
21 /* UART config */
22 #define CONFIG_MXC_UART_BASE			UART1_BASE
23 
24 /* I2C config */
25 #define CONFIG_SYS_I2C
26 #define CONFIG_SYS_I2C_MXC
27 #define CONFIG_SYS_I2C_MXC_I2C1		/* enable I2C bus 1 */
28 #define CONFIG_SYS_I2C_MXC_I2C2		/* enable I2C bus 2 */
29 #define CONFIG_SYS_I2C_MXC_I2C3		/* enable I2C bus 3 */
30 #define CONFIG_SYS_I2C_SPEED			100000
31 
32 /* MMC config */
33 #define CONFIG_SYS_FSL_ESDHC_ADDR		0
34 #define CONFIG_SYS_FSL_USDHC_NUM		1
35 
36 /* Ethernet config */
37 #define CONFIG_FEC_MXC
38 #define IMX_FEC_BASE				ENET_BASE_ADDR
39 
40 /* USB config */
41 #define CONFIG_MXC_USB_PORT			1
42 #define CONFIG_MXC_USB_PORTSC			(PORT_PTS_UTMI | PORT_PTS_PTW)
43 #define CONFIG_MXC_USB_FLAGS			0
44 
45 /* Memory config */
46 #define PHYS_SDRAM				MMDC0_ARB_BASE_ADDR
47 #ifndef PHYS_SDRAM_SIZE
48 #define PHYS_SDRAM_SIZE				(1024 << 20)
49 #endif
50 
51 #define CONFIG_SYS_SDRAM_BASE			PHYS_SDRAM
52 #define CONFIG_SYS_INIT_RAM_ADDR		IRAM_BASE_ADDR
53 #define CONFIG_SYS_INIT_RAM_SIZE		IRAM_SIZE
54 
55 #define CONFIG_SYS_INIT_SP_OFFSET		(CONFIG_SYS_INIT_RAM_SIZE - \
56 						 GENERATED_GBL_DATA_SIZE)
57 #define CONFIG_SYS_INIT_SP_ADDR			(CONFIG_SYS_INIT_RAM_ADDR + \
58 						 CONFIG_SYS_INIT_SP_OFFSET)
59 
60 #define CONFIG_SYS_MALLOC_LEN			(16 * 1024 * 1024)
61 
62 #ifdef CONFIG_CMD_NAND
63 
64 /* NAND config */
65 #ifndef CONFIG_SYS_NAND_MAX_CHIPS
66 #define CONFIG_SYS_NAND_MAX_CHIPS		2
67 #endif
68 #define CONFIG_SYS_MAX_NAND_DEVICE		1
69 #define CONFIG_SYS_NAND_BASE			0x40000000
70 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
71 #define CONFIG_SYS_NAND_ONFI_DETECTION
72 
73 /* DMA config, needed for GPMI/MXS NAND support */
74 
75 /* Environment in NAND */
76 
77 #else /* CONFIG_CMD_NAND */
78 
79 /* Environment in MMC */
80 
81 #endif /* CONFIG_CMD_NAND */
82 
83 /*
84  * U-Boot configuration
85  */
86 
87 /* Board startup config */
88 
89 #define CONFIG_BOOTCOMMAND			"run bootubi_scr"
90 
91 /* Miscellaneous configurable options */
92 
93 /* MTD/UBI/UBIFS config */
94 
95 /*
96  * Environment configuration
97  */
98 
99 #if (CONFIG_SYS_NAND_MAX_CHIPS == 1)
100 #define CONFIG_COMMON_ENV_UBI						\
101 	"setubipartition=env set ubipartition ubi\0"			\
102 	"setubirfs=env set ubirfs $ubipartition:rootfs$boot_vol\0"
103 #elif (CONFIG_SYS_NAND_MAX_CHIPS == 2)
104 #define CONFIG_COMMON_ENV_UBI						\
105 	"setubipartition=env set ubipartition ubi$boot_vol\0"		\
106 	"setubirfs=env set ubirfs ubi0:rootfs\0"
107 #endif
108 
109 #define CONFIG_COMMON_ENV_MISC						\
110 	"user=user\0"							\
111 	"project="CONFIG_PLATINUM_PROJECT"\0"				\
112 	"uimage=uImage\0"						\
113 	"dtb="CONFIG_PLATINUM_CPU"-platinum-"CONFIG_PLATINUM_PROJECT".dtb\0" \
114 	"serverip=serverip\0"						\
115 	"memaddrlinux=0x10800000\0"					\
116 	"memaddrsrc=0x11000000\0"					\
117 	"memaddrdtb=0x12000000\0"					\
118 	"console=ttymxc0\0"						\
119 	"baudrate=115200\0"						\
120 	"boot_scr=boot.uboot\0"						\
121 	"boot_vol=0\0"							\
122 	"mtdids="CONFIG_MTDIDS_DEFAULT"\0"					\
123 	"mtdparts="CONFIG_MTDPARTS_DEFAULT"\0"					\
124 	"mmcfs=ext2\0"							\
125 	"mmcrootpart=1\0"						\
126 	\
127 	"setnfspath=env set nfspath /home/nfs/$user/$project/root\0"	\
128 	"settftpfilelinux=env set tftpfilelinux $user/$project/$uimage\0" \
129 	"settftpfiledtb=env set tftpfiledtb $user/$project/$dtb\0"	\
130 	"setubifilelinux=env set ubifilelinux boot/$uimage\0"		\
131 	"setubipfiledtb=env set ubifiledtb boot/$dtb\0"			\
132 	"setmmcrootdev=env set mmcrootdev /dev/mmcblk0p$mmcrootpart\0"	\
133 	"setmmcfilelinux=env set mmcfilelinux /boot/$uimage\0"		\
134 	"setmmcfiledtb=env set mmcfiledtb /boot/$dtb\0"			\
135 	\
136 	"loadtftpkernel=dhcp $memaddrlinux $tftpfilelinux\0"		\
137 	"loadtftpdtb=dhcp $memaddrdtb $tftpfiledtb\0"			\
138 	"loadubikernel=ubifsload $memaddrlinux $ubifilelinux\0"		\
139 	"loadubidtb=ubifsload $memaddrdtb $ubifiledtb\0"		\
140 	"loadmmckernel=${mmcfs}load mmc 0:$mmcrootpart $memaddrlinux "	\
141 		"$mmcfilelinux\0"					\
142 	"loadmmcdtb=${mmcfs}load mmc 0:$mmcrootpart $memaddrdtb "	\
143 		"$mmcfiledtb\0"						\
144 	\
145 	"ubipart=ubi part $ubipartition\0"				\
146 	"ubimount=ubifsmount $ubirfs\0"					\
147 	\
148 	"setbootargscommon=env set bootargs $bootargs "			\
149 		"console=$console,$baudrate enable_wait_mode=off\0"	\
150 	"setbootargsmtd=env set bootargs $bootargs $mtdparts\0"		\
151 	"setbootargsdhcp=env set bootargs $bootargs ip=dhcp\0"		\
152 	"setbootargsubirfs=env set bootargs $bootargs "			\
153 		"ubi.mtd=$ubipartition root=$ubirfs rootfstype=ubifs\0" \
154 	"setbootargsnfsrfs=env set bootargs $bootargs root=/dev/nfs "	\
155 		"nfsroot=$serverip:$nfspath,v3,tcp\0"			\
156 	"setbootargsmmcrfs=env set bootargs $bootargs "			\
157 		"root=$mmcrootdev rootwait rw\0"			\
158 	\
159 	"bootnet=run settftpfilelinux settftpfiledtb setnfspath "	\
160 		"setbootargscommon setbootargsmtd setbootargsdhcp "	\
161 			"setbootargsnfsrfs;"				\
162 			"run loadtftpkernel loadtftpdtb;"		\
163 			"bootm $memaddrlinux - $memaddrdtb\0"		\
164 	"bootnet_ubirfs=run settftpfilelinux settftpfiledtb;"		\
165 			"run setubipartition setubirfs;"		\
166 			"run setbootargscommon setbootargsmtd "		\
167 				"setbootargsubirfs;"			\
168 			"run loadtftpkernel loadtftpdtb;"		\
169 			"bootm $memaddrlinux - $memaddrdtb\0"		\
170 	"bootubi=run setubipartition setubirfs setubifilelinux "	\
171 				"setubipfiledtb;"			\
172 			"run setbootargscommon setbootargsmtd "		\
173 				"setbootargsubirfs;"			\
174 			"run ubipart ubimount loadubikernel loadubidtb;" \
175 			"bootm $memaddrlinux - $memaddrdtb\0"		\
176 	"bootubi_scr=run setubipartition setubirfs;"			\
177 			"run ubipart ubimount;"				\
178 			"if ubifsload ${memaddrsrc} boot/${boot_scr}; "	\
179 			"then source ${memaddrsrc}; else run bootubi; fi\0" \
180 	"bootmmc=run setmmcrootdev setmmcfilelinux setmmcfiledtb "	\
181 			"setbootargscommon setbootargsmmcrfs;"		\
182 			"run loadmmckernel loadmmcdtb;"			\
183 			"bootm $memaddrlinux - $memaddrdtb\0"		\
184 	\
185 	"bootcmd="CONFIG_BOOTCOMMAND"\0"
186 
187 #define CONFIG_COMMON_ENV_SETTINGS			CONFIG_COMMON_ENV_MISC \
188 							CONFIG_COMMON_ENV_UBI
189 #endif /* __PLATINUM_CONFIG_H__ */
190