xref: /rk3399_rockchip-uboot/include/configs/km/keymile-common.h (revision b648bfc212c0e62dae47b8f09a0c4e49bbd89106)
1264eaa0eSValentin Longchamp /*
2264eaa0eSValentin Longchamp  * (C) Copyright 2008-2011
3264eaa0eSValentin Longchamp  * Heiko Schocher, DENX Software Engineering, hs@denx.de.
4264eaa0eSValentin Longchamp  *
5264eaa0eSValentin Longchamp  * See file CREDITS for list of people who contributed to this
6264eaa0eSValentin Longchamp  * project.
7264eaa0eSValentin Longchamp  *
8264eaa0eSValentin Longchamp  * This program is free software; you can redistribute it and/or
9264eaa0eSValentin Longchamp  * modify it under the terms of the GNU General Public License as
10264eaa0eSValentin Longchamp  * published by the Free Software Foundation; either version 2 of
11264eaa0eSValentin Longchamp  * the License, or (at your option) any later version.
12264eaa0eSValentin Longchamp  *
13264eaa0eSValentin Longchamp  * This program is distributed in the hope that it will be useful,
14264eaa0eSValentin Longchamp  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15264eaa0eSValentin Longchamp  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
16264eaa0eSValentin Longchamp  * GNU General Public License for more details.
17264eaa0eSValentin Longchamp  *
18264eaa0eSValentin Longchamp  * You should have received a copy of the GNU General Public License
19264eaa0eSValentin Longchamp  * along with this program; if not, write to the Free Software
20264eaa0eSValentin Longchamp  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21264eaa0eSValentin Longchamp  * MA 02111-1307 USA
22264eaa0eSValentin Longchamp  */
23264eaa0eSValentin Longchamp 
24264eaa0eSValentin Longchamp #ifndef __CONFIG_KEYMILE_H
25264eaa0eSValentin Longchamp #define __CONFIG_KEYMILE_H
26264eaa0eSValentin Longchamp 
27264eaa0eSValentin Longchamp /* Do boardspecific init for all boards */
28264eaa0eSValentin Longchamp #define CONFIG_BOARD_EARLY_INIT_R
29264eaa0eSValentin Longchamp #define CONFIG_LAST_STAGE_INIT
30264eaa0eSValentin Longchamp 
31264eaa0eSValentin Longchamp #define CONFIG_BOOTCOUNT_LIMIT
32264eaa0eSValentin Longchamp 
33264eaa0eSValentin Longchamp /*
34264eaa0eSValentin Longchamp  * Command line configuration.
35264eaa0eSValentin Longchamp  */
36264eaa0eSValentin Longchamp #include <config_cmd_default.h>
37264eaa0eSValentin Longchamp 
38264eaa0eSValentin Longchamp #define CONFIG_CMD_ASKENV
39264eaa0eSValentin Longchamp #define CONFIG_CMD_DHCP
40264eaa0eSValentin Longchamp #define CONFIG_CMD_ECHO
41264eaa0eSValentin Longchamp #define CONFIG_CMD_IMMAP
42264eaa0eSValentin Longchamp #define CONFIG_CMD_MII
43264eaa0eSValentin Longchamp #define CONFIG_CMD_PING
44264eaa0eSValentin Longchamp #define CONFIG_CMD_EEPROM
45264eaa0eSValentin Longchamp #define CONFIG_CMD_I2C
46264eaa0eSValentin Longchamp #define CONFIG_CMD_JFFS2
47264eaa0eSValentin Longchamp #define CONFIG_CMD_MTDPARTS
48264eaa0eSValentin Longchamp #define CONFIG_CMD_SETEXPR
49264eaa0eSValentin Longchamp 
50264eaa0eSValentin Longchamp #undef	CONFIG_WATCHDOG		/* disable platform specific watchdog */
51264eaa0eSValentin Longchamp 
52264eaa0eSValentin Longchamp #define CONFIG_BOOTDELAY	2 /* autoboot after 2 seconds */
53264eaa0eSValentin Longchamp #undef	CONFIG_BOOTARGS		/* the boot command will set bootargs */
54264eaa0eSValentin Longchamp 
55264eaa0eSValentin Longchamp /*
56264eaa0eSValentin Longchamp  * Miscellaneous configurable options
57264eaa0eSValentin Longchamp  */
58264eaa0eSValentin Longchamp #define CONFIG_SYS_HUSH_PARSER
59264eaa0eSValentin Longchamp #define CONFIG_SYS_PROMPT_HUSH_PS2	"> "
60264eaa0eSValentin Longchamp #define CONFIG_SYS_LONGHELP			/* undef to save memory	  */
61264eaa0eSValentin Longchamp #define CONFIG_SYS_PROMPT		"=> "	/* Monitor Command Prompt */
62264eaa0eSValentin Longchamp #if defined(CONFIG_CMD_KGDB)
63264eaa0eSValentin Longchamp #define CONFIG_SYS_CBSIZE		1024	/* Console I/O Buffer Size */
64264eaa0eSValentin Longchamp #else
65264eaa0eSValentin Longchamp #define CONFIG_SYS_CBSIZE		512	/* Console I/O Buffer Size  */
66264eaa0eSValentin Longchamp #endif
67264eaa0eSValentin Longchamp #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
68264eaa0eSValentin Longchamp #define CONFIG_SYS_MAXARGS		32 /* max number of command args */
69264eaa0eSValentin Longchamp #define CONFIG_SYS_BARGSIZE		CONFIG_SYS_CBSIZE
70264eaa0eSValentin Longchamp #define CONFIG_CMDLINE_EDITING
71264eaa0eSValentin Longchamp #define CONFIG_AUTO_COMPLETE
72264eaa0eSValentin Longchamp 
73264eaa0eSValentin Longchamp #define CONFIG_HUSH_INIT_VAR
74264eaa0eSValentin Longchamp 
75264eaa0eSValentin Longchamp #define CONFIG_SYS_ALT_MEMTEST		/* memory test, takes time */
76264eaa0eSValentin Longchamp 
77264eaa0eSValentin Longchamp #define CONFIG_SYS_HZ			1000	/* decr. freq: 1 ms ticks */
78264eaa0eSValentin Longchamp 
79264eaa0eSValentin Longchamp #define CONFIG_BAUDRATE			115200
80264eaa0eSValentin Longchamp #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 }
81264eaa0eSValentin Longchamp 
82264eaa0eSValentin Longchamp #define CONFIG_LOADS_ECHO
83264eaa0eSValentin Longchamp #define CONFIG_SYS_LOADS_BAUD_CHANGE
84264eaa0eSValentin Longchamp #define CONFIG_SYS_BOARD_DRAM_INIT	/* Used board specific dram_init */
85264eaa0eSValentin Longchamp 
86264eaa0eSValentin Longchamp /*
87264eaa0eSValentin Longchamp  * How to get access to the slot ID.  Put this here to make it easy
88264eaa0eSValentin Longchamp  * to modify in a centralized location.  This is used in the HDLC
89264eaa0eSValentin Longchamp  * driver to set the MAC.
90264eaa0eSValentin Longchamp */
91264eaa0eSValentin Longchamp #define CONFIG_CHECK_ETHERNET_PRESENT
92264eaa0eSValentin Longchamp #define CONFIG_SYS_SLOT_ID_BASE		CONFIG_SYS_KMBEC_FPGA_BASE
93264eaa0eSValentin Longchamp #define CONFIG_SYS_SLOT_ID_OFF		(0x07)	/* register offset */
94264eaa0eSValentin Longchamp #define CONFIG_SYS_SLOT_ID_MASK		(0x3f)	/* mask for slot ID bits */
95264eaa0eSValentin Longchamp 
96264eaa0eSValentin Longchamp #define CONFIG_I2C_MULTI_BUS
97264eaa0eSValentin Longchamp #define CONFIG_SYS_MAX_I2C_BUS		1
98264eaa0eSValentin Longchamp #define CONFIG_SYS_I2C_INIT_BOARD
99264eaa0eSValentin Longchamp #define CONFIG_I2C_MUX
100264eaa0eSValentin Longchamp 
101264eaa0eSValentin Longchamp /* EEprom support */
102264eaa0eSValentin Longchamp #define CONFIG_SYS_I2C_MULTI_EEPROMS
103264eaa0eSValentin Longchamp #define CONFIG_SYS_EEPROM_PAGE_WRITE_ENABLE
104264eaa0eSValentin Longchamp #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS	3
105264eaa0eSValentin Longchamp #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS	10
106264eaa0eSValentin Longchamp 
107264eaa0eSValentin Longchamp /* Support the IVM EEprom */
108264eaa0eSValentin Longchamp #define	CONFIG_SYS_IVM_EEPROM_ADR	0x50
109264eaa0eSValentin Longchamp #define CONFIG_SYS_IVM_EEPROM_MAX_LEN	0x400
110264eaa0eSValentin Longchamp #define CONFIG_SYS_IVM_EEPROM_PAGE_LEN	0x100
111264eaa0eSValentin Longchamp 
112264eaa0eSValentin Longchamp #define	CONFIG_SYS_FLASH_PROTECTION
113264eaa0eSValentin Longchamp 
114264eaa0eSValentin Longchamp /*
115264eaa0eSValentin Longchamp  * BOOTP options
116264eaa0eSValentin Longchamp  */
117264eaa0eSValentin Longchamp #define CONFIG_BOOTP_BOOTFILESIZE
118264eaa0eSValentin Longchamp #define CONFIG_BOOTP_BOOTPATH
119264eaa0eSValentin Longchamp #define CONFIG_BOOTP_GATEWAY
120264eaa0eSValentin Longchamp #define CONFIG_BOOTP_HOSTNAME
121264eaa0eSValentin Longchamp 
122264eaa0eSValentin Longchamp #define CONFIG_SYS_MALLOC_LEN		(4 * 1024 * 1024)
123264eaa0eSValentin Longchamp 
124264eaa0eSValentin Longchamp /* UBI Support for all Keymile boards */
125264eaa0eSValentin Longchamp #define CONFIG_CMD_UBI
126264eaa0eSValentin Longchamp #define CONFIG_RBTREE
127264eaa0eSValentin Longchamp #define CONFIG_MTD_PARTITIONS
128264eaa0eSValentin Longchamp #define CONFIG_MTD_DEVICE
129264eaa0eSValentin Longchamp #define CONFIG_MTD_CONCAT
130264eaa0eSValentin Longchamp 
131264eaa0eSValentin Longchamp /* common powerpc specific env settings */
132264eaa0eSValentin Longchamp #ifndef CONFIG_KM_DEF_ENV_BOOTPARAMS
133264eaa0eSValentin Longchamp #define CONFIG_KM_DEF_ENV_BOOTPARAMS \
134db0bb572SHolger Brunck 	"actual_bank=0\0"
135264eaa0eSValentin Longchamp #endif
136264eaa0eSValentin Longchamp 
137264eaa0eSValentin Longchamp #ifndef CONFIG_KM_DEF_NETDEV
138264eaa0eSValentin Longchamp #define CONFIG_KM_DEF_NETDEV	\
139264eaa0eSValentin Longchamp 	"netdev=eth0\0"
140264eaa0eSValentin Longchamp #endif
141264eaa0eSValentin Longchamp 
142264eaa0eSValentin Longchamp #ifndef CONFIG_KM_UBI_PARTITION_NAME
143264eaa0eSValentin Longchamp #define CONFIG_KM_UBI_PARTITION_NAME	"ubi0"
144264eaa0eSValentin Longchamp #endif
145264eaa0eSValentin Longchamp #ifndef CONFIG_KM_UBI_LINUX_MTD_NAME
146264eaa0eSValentin Longchamp #define CONFIG_KM_UBI_LINUX_MTD_NAME	"ubi0"
147264eaa0eSValentin Longchamp #endif
148264eaa0eSValentin Longchamp 
149264eaa0eSValentin Longchamp #define xstr(s)	str(s)
150264eaa0eSValentin Longchamp #define str(s)	#s
151264eaa0eSValentin Longchamp 
152264eaa0eSValentin Longchamp /*
153264eaa0eSValentin Longchamp  * boottargets
154db0bb572SHolger Brunck  * - set 'subbootcmds'
155264eaa0eSValentin Longchamp  * - set 'bootcmd' and 'altbootcmd'
156264eaa0eSValentin Longchamp  * available targets:
157264eaa0eSValentin Longchamp  * - 'release': for a standalone system		kernel/rootfs from flash
158264eaa0eSValentin Longchamp  */
159264eaa0eSValentin Longchamp #define CONFIG_KM_DEF_ENV_BOOTTARGETS					\
160db0bb572SHolger Brunck 	"subbootcmds=ubiattach ubicopy cramfsloadfdt cramfsloadkernel "	\
161db0bb572SHolger Brunck 		"flashargs add_default addpanic boot\0"			\
162*b648bfc2SHolger Brunck 	"develop="							\
163*b648bfc2SHolger Brunck 		"tftp 200000 scripts/develop-${arch}.txt && "		\
1642d9528e3SHolger Brunck 		"env import -t 200000 ${filesize} && "			\
165*b648bfc2SHolger Brunck 		"run setup_debug_env\0"					\
166*b648bfc2SHolger Brunck 	"ramfs="							\
167*b648bfc2SHolger Brunck 		"tftp 200000 scripts/ramfs-${arch}.txt && "		\
168*b648bfc2SHolger Brunck 		"env import -t 200000 ${filesize} && "			\
169*b648bfc2SHolger Brunck 		"run setup_debug_env\0"					\
170264eaa0eSValentin Longchamp 	""
171264eaa0eSValentin Longchamp 
172264eaa0eSValentin Longchamp /*
173264eaa0eSValentin Longchamp  * bootargs
174264eaa0eSValentin Longchamp  * - modify 'bootargs'
175264eaa0eSValentin Longchamp  *
176db0bb572SHolger Brunck  * - 'add_default': default bootargs common for all arm/ppc boards
177264eaa0eSValentin Longchamp  * - 'addpanic': add kernel panic options
178264eaa0eSValentin Longchamp  * - 'flashargs': defaults arguments for flash base boot
179264eaa0eSValentin Longchamp  *
180264eaa0eSValentin Longchamp  */
181264eaa0eSValentin Longchamp #define CONFIG_KM_DEF_ENV_BOOTARGS					\
182db0bb572SHolger Brunck 	"add_default="							\
183264eaa0eSValentin Longchamp 		"setenv bootargs ${bootargs} "				\
184264eaa0eSValentin Longchamp 		"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}"	\
185db0bb572SHolger Brunck 		":${hostname}:${netdev}:off3"				\
186db0bb572SHolger Brunck 		" console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}"	\
187db0bb572SHolger Brunck 		" mem=${pnvramaddr} init=${init}"			\
188db0bb572SHolger Brunck 		" phram.phram=phvar,${varaddr}," xstr(CONFIG_KM_PHRAM)	\
189db0bb572SHolger Brunck 		" ubi.mtd=" CONFIG_KM_UBI_LINUX_MTD_NAME " "		\
190db0bb572SHolger Brunck 		CONFIG_KM_DEF_BOOT_ARGS_CPU				\
191db0bb572SHolger Brunck 		"\0"							\
192264eaa0eSValentin Longchamp 	"addpanic="							\
1932d9528e3SHolger Brunck 		"setenv bootargs ${bootargs} panic=1 panic_on_oops=1\0"	\
194264eaa0eSValentin Longchamp 	"flashargs="							\
195264eaa0eSValentin Longchamp 		"setenv bootargs "					\
196264eaa0eSValentin Longchamp 		"root=mtdblock:rootfs${boot_bank} "			\
197264eaa0eSValentin Longchamp 		"rootfstype=squashfs ro\0"				\
198264eaa0eSValentin Longchamp 	""
199264eaa0eSValentin Longchamp 
200264eaa0eSValentin Longchamp /*
201264eaa0eSValentin Longchamp  * flash_boot
202264eaa0eSValentin Longchamp  * - commands for booting from flash
203264eaa0eSValentin Longchamp  *
204264eaa0eSValentin Longchamp  * - 'cramfsloadkernel': copy kernel from a cramfs to ram
205264eaa0eSValentin Longchamp  * - 'ubiattach': attach ubi partition
206264eaa0eSValentin Longchamp  * - 'ubicopy': copy ubi volume to ram
207264eaa0eSValentin Longchamp  *              - volume names: bootfs0, bootfs1, bootfs2, ...
208264eaa0eSValentin Longchamp  *
209264eaa0eSValentin Longchamp  * processor specific settings
210264eaa0eSValentin Longchamp  * - 'cramfsloadfdt': copy fdt from a cramfs to ram
211264eaa0eSValentin Longchamp  */
212264eaa0eSValentin Longchamp #define CONFIG_KM_DEF_ENV_FLASH_BOOT					\
213264eaa0eSValentin Longchamp 	"cramfsaddr=" xstr(CONFIG_KM_CRAMFS_ADDR) "\0"			\
214db0bb572SHolger Brunck 	"cramfsloadkernel=cramfsload ${load_addr_r} uImage\0"		\
2152d9528e3SHolger Brunck 	"ubiattach=ubi part " CONFIG_KM_UBI_PARTITION_NAME "\0"		\
2162d9528e3SHolger Brunck 	"ubicopy=ubi read "xstr(CONFIG_KM_CRAMFS_ADDR)			\
2172d9528e3SHolger Brunck 			" bootfs${boot_bank}\0"				\
218264eaa0eSValentin Longchamp 	""
219264eaa0eSValentin Longchamp 
220264eaa0eSValentin Longchamp /*
221264eaa0eSValentin Longchamp  * constants
222264eaa0eSValentin Longchamp  * - KM specific constants and commands
223264eaa0eSValentin Longchamp  *
224264eaa0eSValentin Longchamp  * - 'default': setup default environment
225264eaa0eSValentin Longchamp  */
226264eaa0eSValentin Longchamp #define CONFIG_KM_DEF_ENV_CONSTANTS					\
227264eaa0eSValentin Longchamp 	"backup_bank=0\0"						\
228db0bb572SHolger Brunck 	"release=run newenv; reset\0"					\
229638a48edSHolger Brunck 	"pnvramsize=" xstr(CONFIG_KM_PNVRAM) "\0"			\
2300333cfe6SThomas Herzmann 	"testbootcmd=setenv boot_bank ${test_bank}; "			\
2310333cfe6SThomas Herzmann 		"run ${subbootcmds}; reset\0"				\
232264eaa0eSValentin Longchamp 	""
233264eaa0eSValentin Longchamp 
234264eaa0eSValentin Longchamp #ifndef CONFIG_KM_DEF_ENV
235264eaa0eSValentin Longchamp #define CONFIG_KM_DEF_ENV	\
236264eaa0eSValentin Longchamp 	CONFIG_KM_DEF_ENV_BOOTPARAMS					\
237264eaa0eSValentin Longchamp 	CONFIG_KM_DEF_NETDEV						\
238264eaa0eSValentin Longchamp 	CONFIG_KM_DEF_ENV_CPU						\
239264eaa0eSValentin Longchamp 	CONFIG_KM_DEF_ENV_BOOTTARGETS					\
240264eaa0eSValentin Longchamp 	CONFIG_KM_DEF_ENV_BOOTARGS					\
241264eaa0eSValentin Longchamp 	CONFIG_KM_DEF_ENV_FLASH_BOOT					\
242264eaa0eSValentin Longchamp 	CONFIG_KM_DEF_ENV_CONSTANTS					\
243264eaa0eSValentin Longchamp 	"altbootcmd=run bootcmd\0"					\
244db0bb572SHolger Brunck 	"bootcmd=km_checkbidhwk &&  "					\
245db0bb572SHolger Brunck 	"	setenv bootcmd \'setenv boot_bank ${actual_bank}; "	\
246db0bb572SHolger Brunck 			"run ${subbootcmds}; reset\' && "		\
247db0bb572SHolger Brunck 		"setenv altbootcmd \'setenv boot_bank ${backup_bank}; "	\
248db0bb572SHolger Brunck 			"run ${subbootcmds}; reset\' && "		\
249db0bb572SHolger Brunck 		"saveenv && saveenv && boot\0"				\
250264eaa0eSValentin Longchamp 	"bootlimit=2\0"							\
251264eaa0eSValentin Longchamp 	"init=/sbin/init-overlay.sh\0"					\
252db0bb572SHolger Brunck 	"load_addr_r="xstr(CONFIG_KM_KERNEL_ADDR) "\0"			\
253db0bb572SHolger Brunck 	"load=tftpboot ${load_addr_r} ${u-boot}\0"			\
254264eaa0eSValentin Longchamp 	"mtdids=" MTDIDS_DEFAULT "\0"					\
255264eaa0eSValentin Longchamp 	"mtdparts=" MTDPARTS_DEFAULT "\0"				\
256264eaa0eSValentin Longchamp 	"stderr=serial\0"						\
257264eaa0eSValentin Longchamp 	"stdin=serial\0"						\
258264eaa0eSValentin Longchamp 	"stdout=serial\0"						\
259264eaa0eSValentin Longchamp 	"u-boot="xstr(CONFIG_HOSTNAME) "/u-boot.bin\0"			\
260264eaa0eSValentin Longchamp 	""
261264eaa0eSValentin Longchamp #endif /* CONFIG_KM_DEF_ENV */
262264eaa0eSValentin Longchamp 
263264eaa0eSValentin Longchamp #define CONFIG_VERSION_VARIABLE	/* include version env variable */
264264eaa0eSValentin Longchamp 
265264eaa0eSValentin Longchamp #endif /* __CONFIG_KEYMILE_H */
266