xref: /rk3399_rockchip-uboot/include/configs/platinum.h (revision 78d1e1d0a157c8b48ea19be6170b992745d30f38)
1 /*
2  * Copyright (C) 2014, Barco (www.barco.com)
3  *
4  * SPDX-License-Identifier:	GPL-2.0+
5  */
6 
7 #ifndef __PLATINUM_CONFIG_H__
8 #define __PLATINUM_CONFIG_H__
9 
10 /* SPL */
11 #define CONFIG_SPL_NAND_SUPPORT
12 #define CONFIG_SPL_MMC_SUPPORT
13 
14 /* Location in NAND to read U-Boot from */
15 #define CONFIG_SYS_NAND_U_BOOT_OFFS     (14 * 1024 * 1024)
16 
17 #include "imx6_spl.h"                  /* common IMX6 SPL configuration */
18 #include "mx6_common.h"
19 
20 /*
21  * Console configuration
22  */
23 
24 #define CONFIG_CMD_BMODE
25 #define CONFIG_CMD_MII
26 #define CONFIG_CMD_MTDPARTS
27 #define CONFIG_CMD_NAND
28 #define CONFIG_CMD_NAND_TRIMFFS
29 #define CONFIG_CMD_UBI
30 #define CONFIG_CMD_UBIFS
31 
32 /*
33  * Hardware configuration
34  */
35 
36 /* UART config */
37 #define CONFIG_MXC_UART
38 #define CONFIG_MXC_UART_BASE			UART1_BASE
39 
40 /* I2C config */
41 #define CONFIG_SYS_I2C
42 #define CONFIG_SYS_I2C_MXC
43 #define CONFIG_SYS_I2C_MXC_I2C1		/* enable I2C bus 1 */
44 #define CONFIG_SYS_I2C_MXC_I2C2		/* enable I2C bus 2 */
45 #define CONFIG_SYS_I2C_MXC_I2C3		/* enable I2C bus 3 */
46 #define CONFIG_SYS_I2C_SPEED			100000
47 
48 /* MMC config */
49 #define CONFIG_SYS_FSL_ESDHC_ADDR		0
50 #define CONFIG_SYS_FSL_USDHC_NUM		1
51 
52 /* Ethernet config */
53 #define CONFIG_FEC_MXC
54 #define CONFIG_MII
55 #define IMX_FEC_BASE				ENET_BASE_ADDR
56 
57 #define CONFIG_PHYLIB
58 
59 /* USB config */
60 #define CONFIG_USB_EHCI
61 #define CONFIG_USB_EHCI_MX6
62 #define CONFIG_USB_STORAGE
63 #define CONFIG_MXC_USB_PORT			1
64 #define CONFIG_MXC_USB_PORTSC			(PORT_PTS_UTMI | PORT_PTS_PTW)
65 #define CONFIG_MXC_USB_FLAGS			0
66 
67 /* Memory config */
68 #define CONFIG_NR_DRAM_BANKS			1
69 #define PHYS_SDRAM				MMDC0_ARB_BASE_ADDR
70 #ifndef PHYS_SDRAM_SIZE
71 #define PHYS_SDRAM_SIZE				(1024 << 20)
72 #endif
73 
74 #define CONFIG_SYS_SDRAM_BASE			PHYS_SDRAM
75 #define CONFIG_SYS_INIT_RAM_ADDR		IRAM_BASE_ADDR
76 #define CONFIG_SYS_INIT_RAM_SIZE		IRAM_SIZE
77 
78 #define CONFIG_SYS_INIT_SP_OFFSET		(CONFIG_SYS_INIT_RAM_SIZE - \
79 						 GENERATED_GBL_DATA_SIZE)
80 #define CONFIG_SYS_INIT_SP_ADDR			(CONFIG_SYS_INIT_RAM_ADDR + \
81 						 CONFIG_SYS_INIT_SP_OFFSET)
82 
83 #define CONFIG_SYS_MALLOC_LEN			(16 * 1024 * 1024)
84 
85 #ifdef CONFIG_CMD_NAND
86 
87 /* NAND config */
88 #define CONFIG_NAND_MXS
89 #ifndef CONFIG_SYS_NAND_MAX_CHIPS
90 #define CONFIG_SYS_NAND_MAX_CHIPS		2
91 #endif
92 #define CONFIG_SYS_MAX_NAND_DEVICE		1
93 #define CONFIG_SYS_NAND_BASE			0x40000000
94 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
95 #define CONFIG_SYS_NAND_ONFI_DETECTION
96 
97 /* DMA config, needed for GPMI/MXS NAND support */
98 #define CONFIG_APBH_DMA
99 #define CONFIG_APBH_DMA_BURST
100 #define CONFIG_APBH_DMA_BURST8
101 
102 /* Environment in NAND */
103 #define CONFIG_ENV_IS_IN_NAND
104 #define CONFIG_ENV_OFFSET		(16 << 20)
105 #define CONFIG_ENV_SECT_SIZE		(128 << 10)
106 #define CONFIG_ENV_SIZE			CONFIG_ENV_SECT_SIZE
107 #define CONFIG_ENV_OFFSET_REDUND	(CONFIG_ENV_OFFSET + (512 << 10))
108 #define CONFIG_ENV_SIZE_REDUND		CONFIG_ENV_SIZE
109 
110 #else /* CONFIG_CMD_NAND */
111 
112 /* Environment in MMC */
113 #define CONFIG_ENV_SIZE			(8 << 10)
114 #define CONFIG_ENV_IS_IN_MMC
115 #define CONFIG_ENV_OFFSET		(6 * 64 * 1024)
116 #define CONFIG_SYS_MMC_ENV_DEV		0
117 
118 #endif /* CONFIG_CMD_NAND */
119 
120 /*
121  * U-Boot configuration
122  */
123 
124 /* Board startup config */
125 #define CONFIG_BOARD_EARLY_INIT_F
126 #define CONFIG_MISC_INIT_R
127 
128 #define CONFIG_SYS_MEMTEST_START		PHYS_SDRAM
129 #define CONFIG_SYS_MEMTEST_END			(CONFIG_SYS_MEMTEST_START + \
130 						 PHYS_SDRAM_SIZE - (12 << 20))
131 
132 #define CONFIG_BOOTCOMMAND			"run bootubi_scr"
133 
134 /* Miscellaneous configurable options */
135 #define CONFIG_PREBOOT
136 
137 /* Print Buffer Size */
138 #define CONFIG_SYS_PBSIZE			(CONFIG_SYS_CBSIZE + \
139 						 sizeof(CONFIG_SYS_PROMPT) + 16)
140 
141 /* MTD/UBI/UBIFS config */
142 #define CONFIG_LZO
143 #define CONFIG_MTD_DEVICE
144 #define CONFIG_MTD_PARTITIONS
145 #define CONFIG_RBTREE
146 
147 #if (CONFIG_SYS_NAND_MAX_CHIPS == 1)
148 #define MTDIDS_DEFAULT		"nand0=gpmi-nand"
149 #define MTDPARTS_DEFAULT	"mtdparts=gpmi-nand:14M(spl),2M(uboot)," \
150 				"512k(env1),512k(env2),-(ubi)"
151 #elif (CONFIG_SYS_NAND_MAX_CHIPS == 2)
152 #define MTDIDS_DEFAULT		"nand0=gpmi-nand"
153 #define MTDPARTS_DEFAULT	"mtdparts=gpmi-nand:14M(spl),2M(uboot)," \
154 				"512k(env1),512k(env2),495M(ubi0)," \
155 				"14M(res0),2M(res1)," \
156 				"512k(res2),512k(res3),-(ubi1)"
157 #endif
158 
159 /*
160  * Environment configuration
161  */
162 
163 #if (CONFIG_SYS_NAND_MAX_CHIPS == 1)
164 #define CONFIG_COMMON_ENV_UBI						\
165 	"setubipartition=env set ubipartition ubi\0"			\
166 	"setubirfs=env set ubirfs $ubipartition:rootfs$boot_vol\0"
167 #elif (CONFIG_SYS_NAND_MAX_CHIPS == 2)
168 #define CONFIG_COMMON_ENV_UBI						\
169 	"setubipartition=env set ubipartition ubi$boot_vol\0"		\
170 	"setubirfs=env set ubirfs ubi0:rootfs\0"
171 #endif
172 
173 #define CONFIG_COMMON_ENV_MISC						\
174 	"user=user\0"							\
175 	"project="CONFIG_PLATINUM_PROJECT"\0"				\
176 	"uimage=uImage\0"						\
177 	"dtb="CONFIG_PLATINUM_CPU"-platinum-"CONFIG_PLATINUM_PROJECT".dtb\0" \
178 	"serverip=serverip\0"						\
179 	"memaddrlinux=0x10800000\0"					\
180 	"memaddrsrc=0x11000000\0"					\
181 	"memaddrdtb=0x12000000\0"					\
182 	"console=ttymxc0\0"						\
183 	"baudrate=115200\0"						\
184 	"boot_scr=boot.uboot\0"						\
185 	"boot_vol=0\0"							\
186 	"mtdids="MTDIDS_DEFAULT"\0"					\
187 	"mtdparts="MTDPARTS_DEFAULT"\0"					\
188 	"mmcfs=ext2\0"							\
189 	"mmcrootpart=1\0"						\
190 	\
191 	"setnfspath=env set nfspath /home/nfs/$user/$project/root\0"	\
192 	"settftpfilelinux=env set tftpfilelinux $user/$project/$uimage\0" \
193 	"settftpfiledtb=env set tftpfiledtb $user/$project/$dtb\0"	\
194 	"setubifilelinux=env set ubifilelinux boot/$uimage\0"		\
195 	"setubipfiledtb=env set ubifiledtb boot/$dtb\0"			\
196 	"setmmcrootdev=env set mmcrootdev /dev/mmcblk0p$mmcrootpart\0"	\
197 	"setmmcfilelinux=env set mmcfilelinux /boot/$uimage\0"		\
198 	"setmmcfiledtb=env set mmcfiledtb /boot/$dtb\0"			\
199 	\
200 	"loadtftpkernel=dhcp $memaddrlinux $tftpfilelinux\0"		\
201 	"loadtftpdtb=dhcp $memaddrdtb $tftpfiledtb\0"			\
202 	"loadubikernel=ubifsload $memaddrlinux $ubifilelinux\0"		\
203 	"loadubidtb=ubifsload $memaddrdtb $ubifiledtb\0"		\
204 	"loadmmckernel=${mmcfs}load mmc 0:$mmcrootpart $memaddrlinux "	\
205 		"$mmcfilelinux\0"					\
206 	"loadmmcdtb=${mmcfs}load mmc 0:$mmcrootpart $memaddrdtb "	\
207 		"$mmcfiledtb\0"						\
208 	\
209 	"ubipart=ubi part $ubipartition\0"				\
210 	"ubimount=ubifsmount $ubirfs\0"					\
211 	\
212 	"setbootargscommon=env set bootargs $bootargs "			\
213 		"console=$console,$baudrate enable_wait_mode=off\0"	\
214 	"setbootargsmtd=env set bootargs $bootargs $mtdparts\0"		\
215 	"setbootargsdhcp=env set bootargs $bootargs ip=dhcp\0"		\
216 	"setbootargsubirfs=env set bootargs $bootargs "			\
217 		"ubi.mtd=$ubipartition root=$ubirfs rootfstype=ubifs\0" \
218 	"setbootargsnfsrfs=env set bootargs $bootargs root=/dev/nfs "	\
219 		"nfsroot=$serverip:$nfspath,v3,tcp\0"			\
220 	"setbootargsmmcrfs=env set bootargs $bootargs "			\
221 		"root=$mmcrootdev rootwait rw\0"			\
222 	\
223 	"bootnet=run settftpfilelinux settftpfiledtb setnfspath "	\
224 		"setbootargscommon setbootargsmtd setbootargsdhcp "	\
225 			"setbootargsnfsrfs;"				\
226 			"run loadtftpkernel loadtftpdtb;"		\
227 			"bootm $memaddrlinux - $memaddrdtb\0"		\
228 	"bootnet_ubirfs=run settftpfilelinux settftpfiledtb;"		\
229 			"run setubipartition setubirfs;"		\
230 			"run setbootargscommon setbootargsmtd "		\
231 				"setbootargsubirfs;"			\
232 			"run loadtftpkernel loadtftpdtb;"		\
233 			"bootm $memaddrlinux - $memaddrdtb\0"		\
234 	"bootubi=run setubipartition setubirfs setubifilelinux "	\
235 				"setubipfiledtb;"			\
236 			"run setbootargscommon setbootargsmtd "		\
237 				"setbootargsubirfs;"			\
238 			"run ubipart ubimount loadubikernel loadubidtb;" \
239 			"bootm $memaddrlinux - $memaddrdtb\0"		\
240 	"bootubi_scr=run setubipartition setubirfs;"			\
241 			"run ubipart ubimount;"				\
242 			"if ubifsload ${memaddrsrc} boot/${boot_scr}; "	\
243 			"then source ${memaddrsrc}; else run bootubi; fi\0" \
244 	"bootmmc=run setmmcrootdev setmmcfilelinux setmmcfiledtb "	\
245 			"setbootargscommon setbootargsmmcrfs;"		\
246 			"run loadmmckernel loadmmcdtb;"			\
247 			"bootm $memaddrlinux - $memaddrdtb\0"		\
248 	\
249 	"bootcmd="CONFIG_BOOTCOMMAND"\0"
250 
251 #define CONFIG_COMMON_ENV_SETTINGS			CONFIG_COMMON_ENV_MISC \
252 							CONFIG_COMMON_ENV_UBI
253 #endif /* __PLATINUM_CONFIG_H__ */
254