xref: /rk3399_rockchip-uboot/include/configs/km/keymile-common.h (revision dacc109c41f82fcce68bd77e531663b485708f7a)
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_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 
85264eaa0eSValentin Longchamp #define CONFIG_I2C_MULTI_BUS
86264eaa0eSValentin Longchamp #define CONFIG_SYS_MAX_I2C_BUS		1
87264eaa0eSValentin Longchamp #define CONFIG_SYS_I2C_INIT_BOARD
88264eaa0eSValentin Longchamp #define CONFIG_I2C_MUX
89264eaa0eSValentin Longchamp 
90264eaa0eSValentin Longchamp /* Support the IVM EEprom */
91264eaa0eSValentin Longchamp #define	CONFIG_SYS_IVM_EEPROM_ADR	0x50
92264eaa0eSValentin Longchamp #define CONFIG_SYS_IVM_EEPROM_MAX_LEN	0x400
93264eaa0eSValentin Longchamp #define CONFIG_SYS_IVM_EEPROM_PAGE_LEN	0x100
94264eaa0eSValentin Longchamp 
95264eaa0eSValentin Longchamp #define	CONFIG_SYS_FLASH_PROTECTION
96264eaa0eSValentin Longchamp 
97264eaa0eSValentin Longchamp /*
98264eaa0eSValentin Longchamp  * BOOTP options
99264eaa0eSValentin Longchamp  */
100264eaa0eSValentin Longchamp #define CONFIG_BOOTP_BOOTFILESIZE
101264eaa0eSValentin Longchamp #define CONFIG_BOOTP_BOOTPATH
102264eaa0eSValentin Longchamp #define CONFIG_BOOTP_GATEWAY
103264eaa0eSValentin Longchamp #define CONFIG_BOOTP_HOSTNAME
104264eaa0eSValentin Longchamp 
105264eaa0eSValentin Longchamp #define CONFIG_SYS_MALLOC_LEN		(4 * 1024 * 1024)
106264eaa0eSValentin Longchamp 
107264eaa0eSValentin Longchamp /* UBI Support for all Keymile boards */
108264eaa0eSValentin Longchamp #define CONFIG_CMD_UBI
109264eaa0eSValentin Longchamp #define CONFIG_RBTREE
110264eaa0eSValentin Longchamp #define CONFIG_MTD_PARTITIONS
111264eaa0eSValentin Longchamp #define CONFIG_MTD_DEVICE
112264eaa0eSValentin Longchamp #define CONFIG_MTD_CONCAT
113264eaa0eSValentin Longchamp 
114f7fb46a8SHolger Brunck #define CONFIG_CMD_CRAMFS
115f7fb46a8SHolger Brunck #define CONFIG_CRAMFS_CMDLINE
116f7fb46a8SHolger Brunck 
117264eaa0eSValentin Longchamp #ifndef CONFIG_KM_DEF_ENV_BOOTPARAMS
118264eaa0eSValentin Longchamp #define CONFIG_KM_DEF_ENV_BOOTPARAMS \
119db0bb572SHolger Brunck 	"actual_bank=0\0"
120264eaa0eSValentin Longchamp #endif
121264eaa0eSValentin Longchamp 
122264eaa0eSValentin Longchamp #ifndef CONFIG_KM_DEF_NETDEV
123264eaa0eSValentin Longchamp #define CONFIG_KM_DEF_NETDEV	\
124264eaa0eSValentin Longchamp 	"netdev=eth0\0"
125264eaa0eSValentin Longchamp #endif
126264eaa0eSValentin Longchamp 
127cf73639dSAndreas Huber #ifndef CONFIG_KM_UBI_PARTITION_NAME_BOOT
128cf73639dSAndreas Huber #define CONFIG_KM_UBI_PARTITION_NAME_BOOT	"ubi0"
129cf73639dSAndreas Huber #endif /* CONFIG_KM_UBI_PARTITION_NAME_BOOT */
130cf73639dSAndreas Huber 
131cf73639dSAndreas Huber #ifndef CONFIG_KM_UBI_PARTITION_NAME_APP
132cf73639dSAndreas Huber /* one flash chip only called boot */
133cf73639dSAndreas Huber /* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
134cf73639dSAndreas Huber # define CONFIG_KM_UBI_LINUX_MTD					\
135cf73639dSAndreas Huber 	"ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT
136cf73639dSAndreas Huber # define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI				\
137cf73639dSAndreas Huber 	"ubiattach=ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "\0"
138cf73639dSAndreas Huber #else /* CONFIG_KM_UBI_PARTITION_NAME_APP */
139cf73639dSAndreas Huber /* two flash chips called boot and app */
140cf73639dSAndreas Huber /* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
141cf73639dSAndreas Huber /* app:  CONFIG_KM_UBI_PARTITION_NAME_APP */
142cf73639dSAndreas Huber # define CONFIG_KM_UBI_LINUX_MTD					\
143cf73639dSAndreas Huber 	"ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT " "		\
144cf73639dSAndreas Huber 	"ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_APP
145cf73639dSAndreas Huber # define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI				\
146cf73639dSAndreas Huber 	"ubiattach=if test ${boot_bank} -eq 0; then; "			\
147cf73639dSAndreas Huber 	"ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "; else; "	\
148cf73639dSAndreas Huber 	"ubi part " CONFIG_KM_UBI_PARTITION_NAME_APP "; fi\0"
149cf73639dSAndreas Huber #endif /* CONFIG_KM_UBI_PARTITION_NAME_APP */
150264eaa0eSValentin Longchamp 
151*dacc109cSAndreas Huber #ifdef CONFIG_NAND_ECC_BCH
152*dacc109cSAndreas Huber #define CONFIG_KM_UIMAGE_NAME "ecc_bch_uImage\0"
153*dacc109cSAndreas Huber #else
154*dacc109cSAndreas Huber #define CONFIG_KM_UIMAGE_NAME "uImage\0"
155*dacc109cSAndreas Huber #endif
156*dacc109cSAndreas Huber 
157264eaa0eSValentin Longchamp /*
158264eaa0eSValentin Longchamp  * boottargets
159db0bb572SHolger Brunck  * - set 'subbootcmds'
160264eaa0eSValentin Longchamp  * - set 'bootcmd' and 'altbootcmd'
161264eaa0eSValentin Longchamp  * available targets:
162264eaa0eSValentin Longchamp  * - 'release': for a standalone system		kernel/rootfs from flash
163264eaa0eSValentin Longchamp  */
164264eaa0eSValentin Longchamp #define CONFIG_KM_DEF_ENV_BOOTTARGETS					\
165db0bb572SHolger Brunck 	"subbootcmds=ubiattach ubicopy cramfsloadfdt cramfsloadkernel "	\
166db0bb572SHolger Brunck 		"flashargs add_default addpanic boot\0"			\
167b648bfc2SHolger Brunck 	"develop="							\
168b648bfc2SHolger Brunck 		"tftp 200000 scripts/develop-${arch}.txt && "		\
1692d9528e3SHolger Brunck 		"env import -t 200000 ${filesize} && "			\
170b648bfc2SHolger Brunck 		"run setup_debug_env\0"					\
171b648bfc2SHolger Brunck 	"ramfs="							\
172b648bfc2SHolger Brunck 		"tftp 200000 scripts/ramfs-${arch}.txt && "		\
173b648bfc2SHolger Brunck 		"env import -t 200000 ${filesize} && "			\
174b648bfc2SHolger Brunck 		"run setup_debug_env\0"					\
175264eaa0eSValentin Longchamp 	""
176264eaa0eSValentin Longchamp 
177264eaa0eSValentin Longchamp /*
178264eaa0eSValentin Longchamp  * bootargs
179264eaa0eSValentin Longchamp  * - modify 'bootargs'
180264eaa0eSValentin Longchamp  *
181db0bb572SHolger Brunck  * - 'add_default': default bootargs common for all arm/ppc boards
182264eaa0eSValentin Longchamp  * - 'addpanic': add kernel panic options
183264eaa0eSValentin Longchamp  * - 'flashargs': defaults arguments for flash base boot
184264eaa0eSValentin Longchamp  *
185264eaa0eSValentin Longchamp  */
186264eaa0eSValentin Longchamp #define CONFIG_KM_DEF_ENV_BOOTARGS					\
187db0bb572SHolger Brunck 	"add_default="							\
188264eaa0eSValentin Longchamp 		"setenv bootargs ${bootargs} "				\
189264eaa0eSValentin Longchamp 		"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}"	\
190db0bb572SHolger Brunck 		":${hostname}:${netdev}:off3"				\
191db0bb572SHolger Brunck 		" console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}"	\
1922a7714ceSAndreas Huber 		" mem=${kernelmem} init=${init}"			\
19393ea89f0SMarek Vasut 		" phram.phram=phvar,${varaddr}," __stringify(CONFIG_KM_PHRAM)\
194cf73639dSAndreas Huber 		" " CONFIG_KM_UBI_LINUX_MTD " "				\
195db0bb572SHolger Brunck 		CONFIG_KM_DEF_BOOT_ARGS_CPU				\
196db0bb572SHolger Brunck 		"\0"							\
197264eaa0eSValentin Longchamp 	"addpanic="							\
1982d9528e3SHolger Brunck 		"setenv bootargs ${bootargs} panic=1 panic_on_oops=1\0"	\
199264eaa0eSValentin Longchamp 	"flashargs="							\
200264eaa0eSValentin Longchamp 		"setenv bootargs "					\
201264eaa0eSValentin Longchamp 		"root=mtdblock:rootfs${boot_bank} "			\
202264eaa0eSValentin Longchamp 		"rootfstype=squashfs ro\0"				\
203264eaa0eSValentin Longchamp 	""
204264eaa0eSValentin Longchamp 
205264eaa0eSValentin Longchamp /*
206264eaa0eSValentin Longchamp  * flash_boot
207264eaa0eSValentin Longchamp  * - commands for booting from flash
208264eaa0eSValentin Longchamp  *
209264eaa0eSValentin Longchamp  * - 'cramfsloadkernel': copy kernel from a cramfs to ram
210264eaa0eSValentin Longchamp  * - 'ubiattach': attach ubi partition
211264eaa0eSValentin Longchamp  * - 'ubicopy': copy ubi volume to ram
212264eaa0eSValentin Longchamp  *              - volume names: bootfs0, bootfs1, bootfs2, ...
213264eaa0eSValentin Longchamp  *
214264eaa0eSValentin Longchamp  * processor specific settings
215264eaa0eSValentin Longchamp  * - 'cramfsloadfdt': copy fdt from a cramfs to ram
216264eaa0eSValentin Longchamp  */
217264eaa0eSValentin Longchamp #define CONFIG_KM_DEF_ENV_FLASH_BOOT					\
21893ea89f0SMarek Vasut 	"cramfsaddr=" __stringify(CONFIG_KM_CRAMFS_ADDR) "\0"		\
219*dacc109cSAndreas Huber 	"cramfsloadkernel=cramfsload ${load_addr_r} ${uimage}\0"	\
22093ea89f0SMarek Vasut 	"ubicopy=ubi read "__stringify(CONFIG_KM_CRAMFS_ADDR)		\
2212d9528e3SHolger Brunck 			" bootfs${boot_bank}\0"				\
222*dacc109cSAndreas Huber 	"uimage=" CONFIG_KM_UIMAGE_NAME					\
223cf73639dSAndreas Huber 	CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI
224264eaa0eSValentin Longchamp 
225264eaa0eSValentin Longchamp /*
226264eaa0eSValentin Longchamp  * constants
227264eaa0eSValentin Longchamp  * - KM specific constants and commands
228264eaa0eSValentin Longchamp  *
229264eaa0eSValentin Longchamp  * - 'default': setup default environment
230264eaa0eSValentin Longchamp  */
231264eaa0eSValentin Longchamp #define CONFIG_KM_DEF_ENV_CONSTANTS					\
232264eaa0eSValentin Longchamp 	"backup_bank=0\0"						\
233db0bb572SHolger Brunck 	"release=run newenv; reset\0"					\
23493ea89f0SMarek Vasut 	"pnvramsize=" __stringify(CONFIG_KM_PNVRAM) "\0"		\
2350333cfe6SThomas Herzmann 	"testbootcmd=setenv boot_bank ${test_bank}; "			\
2360333cfe6SThomas Herzmann 		"run ${subbootcmds}; reset\0"				\
237264eaa0eSValentin Longchamp 	""
238264eaa0eSValentin Longchamp 
239264eaa0eSValentin Longchamp #ifndef CONFIG_KM_DEF_ENV
240264eaa0eSValentin Longchamp #define CONFIG_KM_DEF_ENV	\
241264eaa0eSValentin Longchamp 	CONFIG_KM_DEF_ENV_BOOTPARAMS					\
242264eaa0eSValentin Longchamp 	CONFIG_KM_DEF_NETDEV						\
243264eaa0eSValentin Longchamp 	CONFIG_KM_DEF_ENV_CPU						\
244264eaa0eSValentin Longchamp 	CONFIG_KM_DEF_ENV_BOOTTARGETS					\
245264eaa0eSValentin Longchamp 	CONFIG_KM_DEF_ENV_BOOTARGS					\
246264eaa0eSValentin Longchamp 	CONFIG_KM_DEF_ENV_FLASH_BOOT					\
247264eaa0eSValentin Longchamp 	CONFIG_KM_DEF_ENV_CONSTANTS					\
248264eaa0eSValentin Longchamp 	"altbootcmd=run bootcmd\0"					\
249db0bb572SHolger Brunck 	"bootcmd=km_checkbidhwk &&  "					\
250c1b3d841SThomas Herzmann 		"setenv bootcmd \'if km_checktestboot; then; "          \
251c1b3d841SThomas Herzmann 				"setenv boot_bank ${test_bank}; else; " \
252c1b3d841SThomas Herzmann 				"setenv boot_bank ${actual_bank}; fi;"  \
253db0bb572SHolger Brunck 			"run ${subbootcmds}; reset\' && "		\
254db0bb572SHolger Brunck 		"setenv altbootcmd \'setenv boot_bank ${backup_bank}; "	\
255db0bb572SHolger Brunck 			"run ${subbootcmds}; reset\' && "		\
256db0bb572SHolger Brunck 		"saveenv && saveenv && boot\0"				\
25731dd8988SHolger Brunck 	"bootlimit=3\0"							\
258264eaa0eSValentin Longchamp 	"init=/sbin/init-overlay.sh\0"					\
25993ea89f0SMarek Vasut 	"load_addr_r="__stringify(CONFIG_KM_KERNEL_ADDR) "\0"		\
260db0bb572SHolger Brunck 	"load=tftpboot ${load_addr_r} ${u-boot}\0"			\
261264eaa0eSValentin Longchamp 	"mtdids=" MTDIDS_DEFAULT "\0"					\
262264eaa0eSValentin Longchamp 	"mtdparts=" MTDPARTS_DEFAULT "\0"				\
263264eaa0eSValentin Longchamp 	""
264264eaa0eSValentin Longchamp #endif /* CONFIG_KM_DEF_ENV */
265264eaa0eSValentin Longchamp 
266264eaa0eSValentin Longchamp #define CONFIG_VERSION_VARIABLE	/* include version env variable */
267264eaa0eSValentin Longchamp 
268264eaa0eSValentin Longchamp #endif /* __CONFIG_KEYMILE_H */
269