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