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