xref: /rk3399_rockchip-uboot/include/configs/apf27.h (revision 577968e5669858e1d5bcb651ab28d60d20166252)
1bcc05c7aStrem /*
2bcc05c7aStrem  *
3bcc05c7aStrem  * Configuration settings for the Armadeus Project motherboard APF27
4bcc05c7aStrem  *
5bcc05c7aStrem  * Copyright (C) 2008-2013 Eric Jarrige <eric.jarrige@armadeus.org>
6bcc05c7aStrem  *
7bcc05c7aStrem  * SPDX-License-Identifier:    GPL-2.0+
8bcc05c7aStrem  */
9bcc05c7aStrem 
10bcc05c7aStrem #ifndef __CONFIG_H
11bcc05c7aStrem #define __CONFIG_H
12bcc05c7aStrem 
13bcc05c7aStrem #define CONFIG_ENV_VERSION	10
14bcc05c7aStrem #define CONFIG_BOARD_NAME apf27
15bcc05c7aStrem 
16bcc05c7aStrem /*
17bcc05c7aStrem  * SoC configurations
18bcc05c7aStrem  */
195d7b131dSMasahiro Yamada #define CONFIG_MX27			/* This is a Freescale i.MX27 Chip */
20bcc05c7aStrem #define CONFIG_MACH_TYPE	1698	/* APF27 */
21bcc05c7aStrem 
22bcc05c7aStrem /*
23bcc05c7aStrem  * Enable the call to miscellaneous platform dependent initialization.
24bcc05c7aStrem  */
25bcc05c7aStrem 
26bcc05c7aStrem /*
27bcc05c7aStrem  * SPL
28bcc05c7aStrem  */
29bcc05c7aStrem #define CONFIG_SPL_TARGET	"u-boot-with-spl.bin"
30bcc05c7aStrem #define CONFIG_SPL_MAX_SIZE	2048
31bcc05c7aStrem #define CONFIG_SPL_TEXT_BASE    0xA0000000
32bcc05c7aStrem 
33bcc05c7aStrem /* NAND boot config */
34bcc05c7aStrem #define CONFIG_SYS_NAND_U_BOOT_START    CONFIG_SYS_TEXT_BASE
35bcc05c7aStrem #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x800
36bcc05c7aStrem #define CONFIG_SYS_NAND_U_BOOT_DST	CONFIG_SYS_TEXT_BASE
37bcc05c7aStrem #define CONFIG_SYS_NAND_U_BOOT_SIZE	CONFIG_SYS_MONITOR_LEN - 0x800
38bcc05c7aStrem 
39bcc05c7aStrem /*
40bcc05c7aStrem  * BOOTP options
41bcc05c7aStrem  */
42bcc05c7aStrem #define CONFIG_BOOTP_SUBNETMASK
43bcc05c7aStrem #define CONFIG_BOOTP_GATEWAY
44bcc05c7aStrem #define CONFIG_BOOTP_HOSTNAME
45bcc05c7aStrem #define CONFIG_BOOTP_BOOTPATH
46bcc05c7aStrem #define CONFIG_BOOTP_BOOTFILESIZE
47bcc05c7aStrem #define CONFIG_BOOTP_DNS
48bcc05c7aStrem #define CONFIG_BOOTP_DNS2
49bcc05c7aStrem 
50bcc05c7aStrem #define CONFIG_HOSTNAME	CONFIG_BOARD_NAME
51bcc05c7aStrem #define CONFIG_ROOTPATH	"/tftpboot/" __stringify(CONFIG_BOARD_NAME) "-root"
52bcc05c7aStrem 
53bcc05c7aStrem /*
54bcc05c7aStrem  * Memory configurations
55bcc05c7aStrem  */
56bcc05c7aStrem #define CONFIG_NR_DRAM_POPULATED 1
57bcc05c7aStrem #define CONFIG_NR_DRAM_BANKS	2
58bcc05c7aStrem 
59bcc05c7aStrem #define ACFG_SDRAM_MBYTE_SYZE 64
60bcc05c7aStrem 
61bcc05c7aStrem #define PHYS_SDRAM_1			0xA0000000
62bcc05c7aStrem #define PHYS_SDRAM_2			0xB0000000
63bcc05c7aStrem #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM_1
64bcc05c7aStrem #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (512<<10))
65bcc05c7aStrem #define CONFIG_SYS_MEMTEST_START	0xA0000000	/* memtest test area  */
66bcc05c7aStrem #define CONFIG_SYS_MEMTEST_END		0xA0300000	/* 3 MiB RAM test */
67bcc05c7aStrem 
68bcc05c7aStrem #define CONFIG_SYS_INIT_SP_ADDR	(CONFIG_SYS_SDRAM_BASE	\
69bcc05c7aStrem 		+ PHYS_SDRAM_1_SIZE - 0x0100000)
70bcc05c7aStrem 
71bcc05c7aStrem #define CONFIG_SYS_TEXT_BASE		0xA0000800
72bcc05c7aStrem 
73bcc05c7aStrem /*
74bcc05c7aStrem  * FLASH organization
75bcc05c7aStrem  */
76bcc05c7aStrem #define	ACFG_MONITOR_OFFSET		0x00000000
77bcc05c7aStrem #define	CONFIG_SYS_MONITOR_LEN		0x00100000	/* 1MiB */
78bcc05c7aStrem #define	CONFIG_ENV_OVERWRITE
79bcc05c7aStrem #define	CONFIG_ENV_OFFSET		0x00100000	/* NAND offset */
80bcc05c7aStrem #define	CONFIG_ENV_SIZE			0x00020000	/* 128kB  */
81bcc05c7aStrem #define CONFIG_ENV_RANGE		0X00080000	/* 512kB */
82bcc05c7aStrem #define	CONFIG_ENV_OFFSET_REDUND	\
83bcc05c7aStrem 		(CONFIG_ENV_OFFSET + CONFIG_ENV_RANGE)	/* +512kB */
84bcc05c7aStrem #define	CONFIG_ENV_SIZE_REDUND		CONFIG_ENV_SIZE	/* 512kB */
85bcc05c7aStrem #define	CONFIG_FIRMWARE_OFFSET		0x00200000
86bcc05c7aStrem #define	CONFIG_FIRMWARE_SIZE		0x00080000	/* 512kB  */
87bcc05c7aStrem #define	CONFIG_KERNEL_OFFSET		0x00300000
88bcc05c7aStrem #define	CONFIG_ROOTFS_OFFSET		0x00800000
89bcc05c7aStrem 
90bcc05c7aStrem #define CONFIG_MTDMAP			"mxc_nand.0"
91bcc05c7aStrem #define MTDIDS_DEFAULT			"nand0=" CONFIG_MTDMAP
92bcc05c7aStrem #define MTDPARTS_DEFAULT	"mtdparts=" CONFIG_MTDMAP \
93bcc05c7aStrem 				":1M(u-boot)ro," \
94bcc05c7aStrem 				"512K(env)," \
95bcc05c7aStrem 				"512K(env2)," \
96bcc05c7aStrem 				"512K(firmware)," \
97bcc05c7aStrem 				"512K(dtb)," \
98bcc05c7aStrem 				"5M(kernel)," \
99bcc05c7aStrem 				"-(rootfs)"
100bcc05c7aStrem 
101bcc05c7aStrem /*
102bcc05c7aStrem  * U-Boot general configurations
103bcc05c7aStrem  */
104bcc05c7aStrem #define CONFIG_SYS_LONGHELP
105bcc05c7aStrem #define CONFIG_SYS_CBSIZE		2048		/* console I/O buffer */
106bcc05c7aStrem #define CONFIG_SYS_BARGSIZE		CONFIG_SYS_CBSIZE
107bcc05c7aStrem 						/* Boot argument buffer size */
108bcc05c7aStrem #define CONFIG_AUTO_COMPLETE
109bcc05c7aStrem #define CONFIG_CMDLINE_EDITING
110bcc05c7aStrem #define CONFIG_ENV_VARS_UBOOT_CONFIG
111bcc05c7aStrem #define CONFIG_PREBOOT			"run check_flash check_env;"
112bcc05c7aStrem 
113bcc05c7aStrem /*
114bcc05c7aStrem  * Boot Linux
115bcc05c7aStrem  */
116bcc05c7aStrem #define CONFIG_CMDLINE_TAG		/* send commandline to Kernel	*/
117bcc05c7aStrem #define CONFIG_SETUP_MEMORY_TAGS	/* send memory definition to kernel */
118bcc05c7aStrem #define CONFIG_INITRD_TAG		/* send initrd params	*/
119bcc05c7aStrem 
120bcc05c7aStrem #define	CONFIG_BOOTFILE		__stringify(CONFIG_BOARD_NAME) "-linux.bin"
121bcc05c7aStrem 
122bcc05c7aStrem #define ACFG_CONSOLE_DEV	ttySMX0
123bcc05c7aStrem #define CONFIG_BOOTCOMMAND	"run ubifsboot"
124bcc05c7aStrem #define CONFIG_SYS_AUTOLOAD	"no"
125bcc05c7aStrem /*
126bcc05c7aStrem  * Default load address for user programs and kernel
127bcc05c7aStrem  */
128bcc05c7aStrem #define CONFIG_LOADADDR			0xA0000000
129bcc05c7aStrem #define	CONFIG_SYS_LOAD_ADDR		CONFIG_LOADADDR
130bcc05c7aStrem 
131bcc05c7aStrem /*
132bcc05c7aStrem  * Extra Environments
133bcc05c7aStrem  */
134bcc05c7aStrem #define CONFIG_EXTRA_ENV_SETTINGS \
135bcc05c7aStrem 	"env_version="		__stringify(CONFIG_ENV_VERSION)		"\0" \
136bcc05c7aStrem 	"consoledev="		__stringify(ACFG_CONSOLE_DEV)		"\0" \
137bcc05c7aStrem 	"mtdparts="		MTDPARTS_DEFAULT			"\0" \
138bcc05c7aStrem 	"partition=nand0,6\0"						\
139bcc05c7aStrem 	"u-boot_addr="		__stringify(ACFG_MONITOR_OFFSET)	"\0" \
140bcc05c7aStrem 	"env_addr="		__stringify(CONFIG_ENV_OFFSET)		"\0" \
141bcc05c7aStrem 	"firmware_addr="	__stringify(CONFIG_FIRMWARE_OFFSET)	"\0" \
142bcc05c7aStrem 	"firmware_size="	__stringify(CONFIG_FIRMWARE_SIZE)	"\0" \
143bcc05c7aStrem 	"kernel_addr="		__stringify(CONFIG_KERNEL_OFFSET)	"\0" \
144bcc05c7aStrem 	"rootfs_addr="		__stringify(CONFIG_ROOTFS_OFFSET)	"\0" \
145bcc05c7aStrem 	"board_name="		__stringify(CONFIG_BOARD_NAME)		"\0" \
146bcc05c7aStrem 	"kernel_addr_r=A0000000\0" \
147bcc05c7aStrem 	"check_env=if test -n ${flash_env_version}; "			\
148bcc05c7aStrem 		"then env default env_version; "			\
149bcc05c7aStrem 		"else env set flash_env_version ${env_version}; env save; "\
150bcc05c7aStrem 		"fi; "							\
151bcc05c7aStrem 		"if itest ${flash_env_version} < ${env_version}; then " \
152bcc05c7aStrem 			"echo \"*** Warning - Environment version"	\
153bcc05c7aStrem 			" change suggests: run flash_reset_env; reset\"; "\
154bcc05c7aStrem 			"env default flash_reset_env; "\
155bcc05c7aStrem 		"fi; \0"						\
156bcc05c7aStrem 	"check_flash=nand lock; nand unlock ${env_addr}; \0"	\
157bcc05c7aStrem 	"flash_reset_env=env default -f -a; saveenv; run update_env;"	\
158bcc05c7aStrem 		"echo Flash environment variables erased!\0"		\
159bcc05c7aStrem 	"download_uboot=tftpboot ${loadaddr} ${board_name}"		\
160bcc05c7aStrem 		"-u-boot-with-spl.bin\0"				\
161bcc05c7aStrem 	"flash_uboot=nand unlock ${u-boot_addr} ;"			\
162bcc05c7aStrem 		"nand erase.part u-boot;"		\
163bcc05c7aStrem 		"if nand write.trimffs ${fileaddr} ${u-boot_addr} ${filesize};"\
164bcc05c7aStrem 			"then nand lock; nand unlock ${env_addr};"	\
165bcc05c7aStrem 				"echo Flashing of uboot succeed;"	\
166bcc05c7aStrem 			"else echo Flashing of uboot failed;"		\
167bcc05c7aStrem 		"fi; \0"						\
168bcc05c7aStrem 	"update_uboot=run download_uboot flash_uboot\0"			\
169bcc05c7aStrem 	"download_env=tftpboot ${loadaddr} ${board_name}"		\
170bcc05c7aStrem 		"-u-boot-env.txt\0"				\
171bcc05c7aStrem 	"flash_env=env import -t ${loadaddr}; env save; \0"		\
172bcc05c7aStrem 	"update_env=run download_env flash_env\0"			\
173bcc05c7aStrem 	"update_all=run update_env update_uboot\0"			\
174bcc05c7aStrem 	"unlock_regs=mw 10000008 0; mw 10020008 0\0"			\
175bcc05c7aStrem 
176bcc05c7aStrem /*
177bcc05c7aStrem  * Serial Driver
178bcc05c7aStrem  */
179bcc05c7aStrem #define CONFIG_MXC_UART
180bcc05c7aStrem #define CONFIG_CONS_INDEX		1
181bcc05c7aStrem #define CONFIG_MXC_UART_BASE		UART1_BASE
182bcc05c7aStrem 
183bcc05c7aStrem /*
184bcc05c7aStrem  * GPIO
185bcc05c7aStrem  */
186bcc05c7aStrem #define CONFIG_MXC_GPIO
187bcc05c7aStrem 
188bcc05c7aStrem /*
189bcc05c7aStrem  * NOR
190bcc05c7aStrem  */
191bcc05c7aStrem 
192bcc05c7aStrem /*
193bcc05c7aStrem  * NAND
194bcc05c7aStrem  */
195bcc05c7aStrem 
196bcc05c7aStrem #define CONFIG_MXC_NAND_REGS_BASE	0xD8000000
197bcc05c7aStrem #define CONFIG_SYS_NAND_BASE		CONFIG_MXC_NAND_REGS_BASE
198bcc05c7aStrem #define CONFIG_SYS_MAX_NAND_DEVICE	1
199bcc05c7aStrem 
200bcc05c7aStrem #define CONFIG_MXC_NAND_HWECC
201bcc05c7aStrem #define CONFIG_SYS_NAND_LARGEPAGE
202bcc05c7aStrem #define CONFIG_SYS_NAND_PAGE_SIZE	2048
203bcc05c7aStrem #define CONFIG_SYS_NAND_BLOCK_SIZE	(128 * 1024)
204bcc05c7aStrem #define CONFIG_SYS_NAND_PAGE_COUNT	CONFIG_SYS_NAND_BLOCK_SIZE / \
205bcc05c7aStrem 						CONFIG_SYS_NAND_PAGE_SIZE
206bcc05c7aStrem #define CONFIG_SYS_NAND_SIZE		(256 * 1024 * 1024)
207bcc05c7aStrem #define CONFIG_SYS_NAND_BAD_BLOCK_POS	11
208bcc05c7aStrem #define NAND_MAX_CHIPS			1
209bcc05c7aStrem 
210bcc05c7aStrem #define CONFIG_FLASH_SHOW_PROGRESS	45
211bcc05c7aStrem #define CONFIG_SYS_NAND_QUIET		1
212bcc05c7aStrem 
213bcc05c7aStrem /*
214bcc05c7aStrem  * Partitions & Filsystems
215bcc05c7aStrem  */
216bcc05c7aStrem 
217bcc05c7aStrem /*
218bcc05c7aStrem  * Ethernet (on SOC imx FEC)
219bcc05c7aStrem  */
220bcc05c7aStrem #define CONFIG_FEC_MXC
221bcc05c7aStrem #define CONFIG_FEC_MXC_PHYADDR		0x1f
222bcc05c7aStrem #define CONFIG_MII				/* MII PHY management	*/
223bcc05c7aStrem 
224bcc05c7aStrem /*
225b5e7f1bcStrem  * FPGA
226b5e7f1bcStrem  */
227b5e7f1bcStrem #ifndef CONFIG_SPL_BUILD
228b5e7f1bcStrem #define CONFIG_FPGA
229b5e7f1bcStrem #endif
230b5e7f1bcStrem #define CONFIG_FPGA_COUNT		1
231b5e7f1bcStrem #define CONFIG_FPGA_XILINX
232b5e7f1bcStrem #define CONFIG_FPGA_SPARTAN3
233b5e7f1bcStrem #define CONFIG_SYS_FPGA_WAIT		250 /* 250 ms */
234b5e7f1bcStrem #define CONFIG_SYS_FPGA_PROG_FEEDBACK
235b5e7f1bcStrem #define CONFIG_SYS_FPGA_CHECK_CTRLC
236b5e7f1bcStrem #define CONFIG_SYS_FPGA_CHECK_ERROR
237b5e7f1bcStrem 
238b5e7f1bcStrem /*
239bcc05c7aStrem  * Fuses - IIM
240bcc05c7aStrem  */
241bcc05c7aStrem #ifdef CONFIG_CMD_IMX_FUSE
242bcc05c7aStrem #define IIM_MAC_BANK		0
243bcc05c7aStrem #define IIM_MAC_ROW		5
244bcc05c7aStrem #define IIM0_SCC_KEY		11
245bcc05c7aStrem #define IIM1_SUID		1
246bcc05c7aStrem #endif
247bcc05c7aStrem 
248bcc05c7aStrem /*
249bcc05c7aStrem  * I2C
250bcc05c7aStrem  */
251bcc05c7aStrem 
252bcc05c7aStrem #ifdef CONFIG_CMD_I2C
253b089d039Strem #define CONFIG_SYS_I2C
254b089d039Strem #define CONFIG_SYS_I2C_MXC
255*03544c66SAlbert ARIBAUD \\(3ADEV\\) #define CONFIG_SYS_I2C_MXC_I2C1		/* enable I2C bus 1 */
256*03544c66SAlbert ARIBAUD \\(3ADEV\\) #define CONFIG_SYS_I2C_MXC_I2C2		/* enable I2C bus 2 */
257b089d039Strem #define CONFIG_SYS_MXC_I2C1_SPEED	100000	/* 100 kHz */
258b089d039Strem #define CONFIG_SYS_MXC_I2C1_SLAVE	0x7F
259b089d039Strem #define CONFIG_SYS_MXC_I2C2_SPEED	100000	/* 100 kHz */
260b089d039Strem #define CONFIG_SYS_MXC_I2C2_SLAVE	0x7F
261bcc05c7aStrem #define CONFIG_SYS_I2C_NOPROBES		{ }
262bcc05c7aStrem 
263bcc05c7aStrem #ifdef CONFIG_CMD_EEPROM
264bcc05c7aStrem # define CONFIG_SYS_I2C_EEPROM_ADDR	0x50	/* EEPROM 24LC02 */
265bcc05c7aStrem # define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1	/* bytes of address */
266bcc05c7aStrem #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS	3
267bcc05c7aStrem #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS	10	/* msec */
268bcc05c7aStrem #endif /* CONFIG_CMD_EEPROM */
269bcc05c7aStrem #endif /* CONFIG_CMD_I2C */
270bcc05c7aStrem 
271bcc05c7aStrem /*
272bcc05c7aStrem  * SD/MMC
273bcc05c7aStrem  */
274bcc05c7aStrem #ifdef CONFIG_CMD_MMC
275bcc05c7aStrem #define CONFIG_MXC_MCI_REGS_BASE	0x10014000
276bcc05c7aStrem #endif
277bcc05c7aStrem 
278bcc05c7aStrem /*
279bcc05c7aStrem  * RTC
280bcc05c7aStrem  */
281bcc05c7aStrem #ifdef CONFIG_CMD_DATE
282bcc05c7aStrem #define CONFIG_RTC_DS1374
283bcc05c7aStrem #define CONFIG_SYS_RTC_BUS_NUM		0
284bcc05c7aStrem #endif /* CONFIG_CMD_DATE */
285bcc05c7aStrem 
286bcc05c7aStrem /*
287bcc05c7aStrem  * PLL
288bcc05c7aStrem  *
289bcc05c7aStrem  *  31 | x  |x| x x x x |x x x x x x x x x x |x x|x x x x|x x x x x x x x x x| 0
290bcc05c7aStrem  *     |CPLM|X|----PD---|--------MFD---------|XXX|--MFI--|-----MFN-----------|
291bcc05c7aStrem  */
292bcc05c7aStrem #define CONFIG_MX27_CLK32		32768	/* 32768 or 32000 Hz crystal */
293bcc05c7aStrem 
294bcc05c7aStrem #if (ACFG_SDRAM_MBYTE_SYZE == 64) /* micron MT46H16M32LF -6 */
295bcc05c7aStrem /* micron 64MB */
296bcc05c7aStrem #define PHYS_SDRAM_1_SIZE			0x04000000 /* 64 MB */
297bcc05c7aStrem #define PHYS_SDRAM_2_SIZE			0x04000000 /* 64 MB */
298bcc05c7aStrem #endif
299bcc05c7aStrem 
300bcc05c7aStrem #if (ACFG_SDRAM_MBYTE_SYZE == 128)
301bcc05c7aStrem /* micron 128MB */
302bcc05c7aStrem #define PHYS_SDRAM_1_SIZE			0x08000000 /* 128 MB */
303bcc05c7aStrem #define PHYS_SDRAM_2_SIZE			0x08000000 /* 128 MB */
304bcc05c7aStrem #endif
305bcc05c7aStrem 
306bcc05c7aStrem #if (ACFG_SDRAM_MBYTE_SYZE == 256)
307bcc05c7aStrem /* micron 256MB */
308bcc05c7aStrem #define PHYS_SDRAM_1_SIZE			0x10000000 /* 256 MB */
309bcc05c7aStrem #define PHYS_SDRAM_2_SIZE			0x10000000 /* 256 MB */
310bcc05c7aStrem #endif
311bcc05c7aStrem 
312bcc05c7aStrem #endif /* __CONFIG_H */
313