xref: /rk3399_rockchip-uboot/include/configs/km/keymile-common.h (revision cf73639d32ebe9f53a4244f81cfd66c39f0e66eb)
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
40b0e55d5bSGerlando Falauto #define CONFIG_CMD_DEFAULTENV_VARS
41264eaa0eSValentin Longchamp #define CONFIG_CMD_ECHO
42264eaa0eSValentin Longchamp #define CONFIG_CMD_IMMAP
43264eaa0eSValentin Longchamp #define CONFIG_CMD_MII
44264eaa0eSValentin Longchamp #define CONFIG_CMD_PING
45264eaa0eSValentin Longchamp #define CONFIG_CMD_EEPROM
46264eaa0eSValentin Longchamp #define CONFIG_CMD_I2C
47264eaa0eSValentin Longchamp #define CONFIG_CMD_JFFS2
48264eaa0eSValentin Longchamp #define CONFIG_CMD_MTDPARTS
49264eaa0eSValentin Longchamp #define CONFIG_CMD_SETEXPR
50264eaa0eSValentin Longchamp 
51264eaa0eSValentin Longchamp #undef	CONFIG_WATCHDOG		/* disable platform specific watchdog */
52264eaa0eSValentin Longchamp 
53264eaa0eSValentin Longchamp #define CONFIG_BOOTDELAY	2 /* autoboot after 2 seconds */
54264eaa0eSValentin Longchamp #undef	CONFIG_BOOTARGS		/* the boot command will set bootargs */
55264eaa0eSValentin Longchamp 
56264eaa0eSValentin Longchamp /*
57264eaa0eSValentin Longchamp  * Miscellaneous configurable options
58264eaa0eSValentin Longchamp  */
59264eaa0eSValentin Longchamp #define CONFIG_SYS_HUSH_PARSER
60264eaa0eSValentin Longchamp #define CONFIG_SYS_PROMPT_HUSH_PS2	"> "
61264eaa0eSValentin Longchamp #define CONFIG_SYS_LONGHELP			/* undef to save memory	  */
62264eaa0eSValentin Longchamp #define CONFIG_SYS_PROMPT		"=> "	/* Monitor Command Prompt */
63264eaa0eSValentin Longchamp #if defined(CONFIG_CMD_KGDB)
64264eaa0eSValentin Longchamp #define CONFIG_SYS_CBSIZE		1024	/* Console I/O Buffer Size */
65264eaa0eSValentin Longchamp #else
66264eaa0eSValentin Longchamp #define CONFIG_SYS_CBSIZE		512	/* Console I/O Buffer Size  */
67264eaa0eSValentin Longchamp #endif
68264eaa0eSValentin Longchamp #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
69264eaa0eSValentin Longchamp #define CONFIG_SYS_MAXARGS		32 /* max number of command args */
70264eaa0eSValentin Longchamp #define CONFIG_SYS_BARGSIZE		CONFIG_SYS_CBSIZE
71264eaa0eSValentin Longchamp #define CONFIG_CMDLINE_EDITING
72264eaa0eSValentin Longchamp #define CONFIG_AUTO_COMPLETE
73264eaa0eSValentin Longchamp 
74264eaa0eSValentin Longchamp #define CONFIG_HUSH_INIT_VAR
75264eaa0eSValentin Longchamp 
76264eaa0eSValentin Longchamp #define CONFIG_SYS_ALT_MEMTEST		/* memory test, takes time */
77264eaa0eSValentin Longchamp 
78264eaa0eSValentin Longchamp #define CONFIG_SYS_HZ			1000	/* decr. freq: 1 ms ticks */
79264eaa0eSValentin Longchamp 
80264eaa0eSValentin Longchamp #define CONFIG_BAUDRATE			115200
81264eaa0eSValentin Longchamp #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 }
82264eaa0eSValentin Longchamp 
83264eaa0eSValentin Longchamp #define CONFIG_LOADS_ECHO
84264eaa0eSValentin Longchamp #define CONFIG_SYS_LOADS_BAUD_CHANGE
85264eaa0eSValentin Longchamp #define CONFIG_SYS_BOARD_DRAM_INIT	/* Used board specific dram_init */
86264eaa0eSValentin Longchamp 
87264eaa0eSValentin Longchamp #define CONFIG_I2C_MULTI_BUS
88264eaa0eSValentin Longchamp #define CONFIG_SYS_MAX_I2C_BUS		1
89264eaa0eSValentin Longchamp #define CONFIG_SYS_I2C_INIT_BOARD
90264eaa0eSValentin Longchamp #define CONFIG_I2C_MUX
91264eaa0eSValentin Longchamp 
92264eaa0eSValentin Longchamp /* Support the IVM EEprom */
93264eaa0eSValentin Longchamp #define	CONFIG_SYS_IVM_EEPROM_ADR	0x50
94264eaa0eSValentin Longchamp #define CONFIG_SYS_IVM_EEPROM_MAX_LEN	0x400
95264eaa0eSValentin Longchamp #define CONFIG_SYS_IVM_EEPROM_PAGE_LEN	0x100
96264eaa0eSValentin Longchamp 
97264eaa0eSValentin Longchamp #define	CONFIG_SYS_FLASH_PROTECTION
98264eaa0eSValentin Longchamp 
99264eaa0eSValentin Longchamp /*
100264eaa0eSValentin Longchamp  * BOOTP options
101264eaa0eSValentin Longchamp  */
102264eaa0eSValentin Longchamp #define CONFIG_BOOTP_BOOTFILESIZE
103264eaa0eSValentin Longchamp #define CONFIG_BOOTP_BOOTPATH
104264eaa0eSValentin Longchamp #define CONFIG_BOOTP_GATEWAY
105264eaa0eSValentin Longchamp #define CONFIG_BOOTP_HOSTNAME
106264eaa0eSValentin Longchamp 
107264eaa0eSValentin Longchamp #define CONFIG_SYS_MALLOC_LEN		(4 * 1024 * 1024)
108264eaa0eSValentin Longchamp 
109264eaa0eSValentin Longchamp /* UBI Support for all Keymile boards */
110264eaa0eSValentin Longchamp #define CONFIG_CMD_UBI
111264eaa0eSValentin Longchamp #define CONFIG_RBTREE
112264eaa0eSValentin Longchamp #define CONFIG_MTD_PARTITIONS
113264eaa0eSValentin Longchamp #define CONFIG_MTD_DEVICE
114264eaa0eSValentin Longchamp #define CONFIG_MTD_CONCAT
115264eaa0eSValentin Longchamp 
116f7fb46a8SHolger Brunck #define CONFIG_CMD_CRAMFS
117f7fb46a8SHolger Brunck #define CONFIG_CRAMFS_CMDLINE
118f7fb46a8SHolger Brunck 
119264eaa0eSValentin Longchamp #ifndef CONFIG_KM_DEF_ENV_BOOTPARAMS
120264eaa0eSValentin Longchamp #define CONFIG_KM_DEF_ENV_BOOTPARAMS \
121db0bb572SHolger Brunck 	"actual_bank=0\0"
122264eaa0eSValentin Longchamp #endif
123264eaa0eSValentin Longchamp 
124264eaa0eSValentin Longchamp #ifndef CONFIG_KM_DEF_NETDEV
125264eaa0eSValentin Longchamp #define CONFIG_KM_DEF_NETDEV	\
126264eaa0eSValentin Longchamp 	"netdev=eth0\0"
127264eaa0eSValentin Longchamp #endif
128264eaa0eSValentin Longchamp 
129*cf73639dSAndreas Huber #ifndef CONFIG_KM_UBI_PARTITION_NAME_BOOT
130*cf73639dSAndreas Huber #define CONFIG_KM_UBI_PARTITION_NAME_BOOT	"ubi0"
131*cf73639dSAndreas Huber #endif /* CONFIG_KM_UBI_PARTITION_NAME_BOOT */
132*cf73639dSAndreas Huber 
133*cf73639dSAndreas Huber #ifndef CONFIG_KM_UBI_PARTITION_NAME_APP
134*cf73639dSAndreas Huber /* one flash chip only called boot */
135*cf73639dSAndreas Huber /* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
136*cf73639dSAndreas Huber # define CONFIG_KM_UBI_LINUX_MTD					\
137*cf73639dSAndreas Huber 	"ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT
138*cf73639dSAndreas Huber # define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI				\
139*cf73639dSAndreas Huber 	"ubiattach=ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "\0"
140*cf73639dSAndreas Huber #else /* CONFIG_KM_UBI_PARTITION_NAME_APP */
141*cf73639dSAndreas Huber /* two flash chips called boot and app */
142*cf73639dSAndreas Huber /* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
143*cf73639dSAndreas Huber /* app:  CONFIG_KM_UBI_PARTITION_NAME_APP */
144*cf73639dSAndreas Huber # define CONFIG_KM_UBI_LINUX_MTD					\
145*cf73639dSAndreas Huber 	"ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT " "		\
146*cf73639dSAndreas Huber 	"ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_APP
147*cf73639dSAndreas Huber # define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI				\
148*cf73639dSAndreas Huber 	"ubiattach=if test ${boot_bank} -eq 0; then; "			\
149*cf73639dSAndreas Huber 	"ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "; else; "	\
150*cf73639dSAndreas Huber 	"ubi part " CONFIG_KM_UBI_PARTITION_NAME_APP "; fi\0"
151*cf73639dSAndreas Huber #endif /* CONFIG_KM_UBI_PARTITION_NAME_APP */
152264eaa0eSValentin Longchamp 
153264eaa0eSValentin Longchamp #define xstr(s)	str(s)
154264eaa0eSValentin Longchamp #define str(s)	#s
155264eaa0eSValentin Longchamp 
156264eaa0eSValentin Longchamp /*
157264eaa0eSValentin Longchamp  * boottargets
158db0bb572SHolger Brunck  * - set 'subbootcmds'
159264eaa0eSValentin Longchamp  * - set 'bootcmd' and 'altbootcmd'
160264eaa0eSValentin Longchamp  * available targets:
161264eaa0eSValentin Longchamp  * - 'release': for a standalone system		kernel/rootfs from flash
162264eaa0eSValentin Longchamp  */
163264eaa0eSValentin Longchamp #define CONFIG_KM_DEF_ENV_BOOTTARGETS					\
164db0bb572SHolger Brunck 	"subbootcmds=ubiattach ubicopy cramfsloadfdt cramfsloadkernel "	\
165db0bb572SHolger Brunck 		"flashargs add_default addpanic boot\0"			\
166b648bfc2SHolger Brunck 	"develop="							\
167b648bfc2SHolger Brunck 		"tftp 200000 scripts/develop-${arch}.txt && "		\
1682d9528e3SHolger Brunck 		"env import -t 200000 ${filesize} && "			\
169b648bfc2SHolger Brunck 		"run setup_debug_env\0"					\
170b648bfc2SHolger Brunck 	"ramfs="							\
171b648bfc2SHolger Brunck 		"tftp 200000 scripts/ramfs-${arch}.txt && "		\
172b648bfc2SHolger Brunck 		"env import -t 200000 ${filesize} && "			\
173b648bfc2SHolger Brunck 		"run setup_debug_env\0"					\
174264eaa0eSValentin Longchamp 	""
175264eaa0eSValentin Longchamp 
176264eaa0eSValentin Longchamp /*
177264eaa0eSValentin Longchamp  * bootargs
178264eaa0eSValentin Longchamp  * - modify 'bootargs'
179264eaa0eSValentin Longchamp  *
180db0bb572SHolger Brunck  * - 'add_default': default bootargs common for all arm/ppc boards
181264eaa0eSValentin Longchamp  * - 'addpanic': add kernel panic options
182264eaa0eSValentin Longchamp  * - 'flashargs': defaults arguments for flash base boot
183264eaa0eSValentin Longchamp  *
184264eaa0eSValentin Longchamp  */
185264eaa0eSValentin Longchamp #define CONFIG_KM_DEF_ENV_BOOTARGS					\
186db0bb572SHolger Brunck 	"add_default="							\
187264eaa0eSValentin Longchamp 		"setenv bootargs ${bootargs} "				\
188264eaa0eSValentin Longchamp 		"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}"	\
189db0bb572SHolger Brunck 		":${hostname}:${netdev}:off3"				\
190db0bb572SHolger Brunck 		" console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}"	\
1912a7714ceSAndreas Huber 		" mem=${kernelmem} init=${init}"			\
192db0bb572SHolger Brunck 		" phram.phram=phvar,${varaddr}," xstr(CONFIG_KM_PHRAM)	\
193*cf73639dSAndreas Huber 		" " CONFIG_KM_UBI_LINUX_MTD " "				\
194db0bb572SHolger Brunck 		CONFIG_KM_DEF_BOOT_ARGS_CPU				\
195db0bb572SHolger Brunck 		"\0"							\
196264eaa0eSValentin Longchamp 	"addpanic="							\
1972d9528e3SHolger Brunck 		"setenv bootargs ${bootargs} panic=1 panic_on_oops=1\0"	\
198264eaa0eSValentin Longchamp 	"flashargs="							\
199264eaa0eSValentin Longchamp 		"setenv bootargs "					\
200264eaa0eSValentin Longchamp 		"root=mtdblock:rootfs${boot_bank} "			\
201264eaa0eSValentin Longchamp 		"rootfstype=squashfs ro\0"				\
202264eaa0eSValentin Longchamp 	""
203264eaa0eSValentin Longchamp 
204264eaa0eSValentin Longchamp /*
205264eaa0eSValentin Longchamp  * flash_boot
206264eaa0eSValentin Longchamp  * - commands for booting from flash
207264eaa0eSValentin Longchamp  *
208264eaa0eSValentin Longchamp  * - 'cramfsloadkernel': copy kernel from a cramfs to ram
209264eaa0eSValentin Longchamp  * - 'ubiattach': attach ubi partition
210264eaa0eSValentin Longchamp  * - 'ubicopy': copy ubi volume to ram
211264eaa0eSValentin Longchamp  *              - volume names: bootfs0, bootfs1, bootfs2, ...
212264eaa0eSValentin Longchamp  *
213264eaa0eSValentin Longchamp  * processor specific settings
214264eaa0eSValentin Longchamp  * - 'cramfsloadfdt': copy fdt from a cramfs to ram
215264eaa0eSValentin Longchamp  */
216264eaa0eSValentin Longchamp #define CONFIG_KM_DEF_ENV_FLASH_BOOT					\
217264eaa0eSValentin Longchamp 	"cramfsaddr=" xstr(CONFIG_KM_CRAMFS_ADDR) "\0"			\
218db0bb572SHolger Brunck 	"cramfsloadkernel=cramfsload ${load_addr_r} uImage\0"		\
2192d9528e3SHolger Brunck 	"ubicopy=ubi read "xstr(CONFIG_KM_CRAMFS_ADDR)			\
2202d9528e3SHolger Brunck 			" bootfs${boot_bank}\0"				\
221*cf73639dSAndreas Huber 	CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI
222264eaa0eSValentin Longchamp 
223264eaa0eSValentin Longchamp /*
224264eaa0eSValentin Longchamp  * constants
225264eaa0eSValentin Longchamp  * - KM specific constants and commands
226264eaa0eSValentin Longchamp  *
227264eaa0eSValentin Longchamp  * - 'default': setup default environment
228264eaa0eSValentin Longchamp  */
229264eaa0eSValentin Longchamp #define CONFIG_KM_DEF_ENV_CONSTANTS					\
230264eaa0eSValentin Longchamp 	"backup_bank=0\0"						\
231db0bb572SHolger Brunck 	"release=run newenv; reset\0"					\
232638a48edSHolger Brunck 	"pnvramsize=" xstr(CONFIG_KM_PNVRAM) "\0"			\
2330333cfe6SThomas Herzmann 	"testbootcmd=setenv boot_bank ${test_bank}; "			\
2340333cfe6SThomas Herzmann 		"run ${subbootcmds}; reset\0"				\
235264eaa0eSValentin Longchamp 	""
236264eaa0eSValentin Longchamp 
237264eaa0eSValentin Longchamp #ifndef CONFIG_KM_DEF_ENV
238264eaa0eSValentin Longchamp #define CONFIG_KM_DEF_ENV	\
239264eaa0eSValentin Longchamp 	CONFIG_KM_DEF_ENV_BOOTPARAMS					\
240264eaa0eSValentin Longchamp 	CONFIG_KM_DEF_NETDEV						\
241264eaa0eSValentin Longchamp 	CONFIG_KM_DEF_ENV_CPU						\
242264eaa0eSValentin Longchamp 	CONFIG_KM_DEF_ENV_BOOTTARGETS					\
243264eaa0eSValentin Longchamp 	CONFIG_KM_DEF_ENV_BOOTARGS					\
244264eaa0eSValentin Longchamp 	CONFIG_KM_DEF_ENV_FLASH_BOOT					\
245264eaa0eSValentin Longchamp 	CONFIG_KM_DEF_ENV_CONSTANTS					\
246264eaa0eSValentin Longchamp 	"altbootcmd=run bootcmd\0"					\
247db0bb572SHolger Brunck 	"bootcmd=km_checkbidhwk &&  "					\
248db0bb572SHolger Brunck 	"	setenv bootcmd \'setenv boot_bank ${actual_bank}; "	\
249db0bb572SHolger Brunck 			"run ${subbootcmds}; reset\' && "		\
250db0bb572SHolger Brunck 		"setenv altbootcmd \'setenv boot_bank ${backup_bank}; "	\
251db0bb572SHolger Brunck 			"run ${subbootcmds}; reset\' && "		\
252db0bb572SHolger Brunck 		"saveenv && saveenv && boot\0"				\
253264eaa0eSValentin Longchamp 	"bootlimit=2\0"							\
254264eaa0eSValentin Longchamp 	"init=/sbin/init-overlay.sh\0"					\
255db0bb572SHolger Brunck 	"load_addr_r="xstr(CONFIG_KM_KERNEL_ADDR) "\0"			\
256db0bb572SHolger Brunck 	"load=tftpboot ${load_addr_r} ${u-boot}\0"			\
257264eaa0eSValentin Longchamp 	"mtdids=" MTDIDS_DEFAULT "\0"					\
258264eaa0eSValentin Longchamp 	"mtdparts=" MTDPARTS_DEFAULT "\0"				\
259264eaa0eSValentin Longchamp 	"stderr=serial\0"						\
260264eaa0eSValentin Longchamp 	"stdin=serial\0"						\
261264eaa0eSValentin Longchamp 	"stdout=serial\0"						\
262264eaa0eSValentin Longchamp 	""
263264eaa0eSValentin Longchamp #endif /* CONFIG_KM_DEF_ENV */
264264eaa0eSValentin Longchamp 
265264eaa0eSValentin Longchamp #define CONFIG_VERSION_VARIABLE	/* include version env variable */
266264eaa0eSValentin Longchamp 
267264eaa0eSValentin Longchamp #endif /* __CONFIG_KEYMILE_H */
268