xref: /rk3399_rockchip-uboot/include/configs/km/keymile-common.h (revision 7c3d6a29cd1ed315185068fd8384d150ef5f967b)
1 /*
2  * (C) Copyright 2008-2011
3  * Heiko Schocher, DENX Software Engineering, hs@denx.de.
4  *
5  * SPDX-License-Identifier:	GPL-2.0+
6  */
7 
8 #ifndef __CONFIG_KEYMILE_H
9 #define __CONFIG_KEYMILE_H
10 
11 #define CONFIG_BOOTCOUNT_LIMIT
12 
13 /*
14  * Command line configuration.
15  */
16 #include <config_cmd_default.h>
17 
18 #define CONFIG_CMD_ASKENV
19 #define CONFIG_CMD_DHCP
20 #define CONFIG_CMD_DEFAULTENV_VARS
21 #define CONFIG_CMD_GREPENV
22 #define CONFIG_CMD_ECHO
23 #define CONFIG_CMD_IMMAP
24 #define CONFIG_CMD_MII
25 #define CONFIG_CMD_PING
26 #define CONFIG_CMD_EEPROM
27 #define CONFIG_CMD_I2C
28 #define CONFIG_CMD_JFFS2
29 #define CONFIG_CMD_MTDPARTS
30 #define CONFIG_CMD_SETEXPR
31 
32 #undef	CONFIG_WATCHDOG		/* disable platform specific watchdog */
33 
34 #define CONFIG_BOOTDELAY	2 /* autoboot after 2 seconds */
35 #undef	CONFIG_BOOTARGS		/* the boot command will set bootargs */
36 
37 /*
38  * Miscellaneous configurable options
39  */
40 #define CONFIG_SYS_HUSH_PARSER
41 #define CONFIG_SYS_LONGHELP			/* undef to save memory	  */
42 #define CONFIG_SYS_PROMPT		"=> "	/* Monitor Command Prompt */
43 #if defined(CONFIG_CMD_KGDB)
44 #define CONFIG_SYS_CBSIZE		1024	/* Console I/O Buffer Size */
45 #else
46 #define CONFIG_SYS_CBSIZE		512	/* Console I/O Buffer Size  */
47 #endif
48 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
49 #define CONFIG_SYS_MAXARGS		32 /* max number of command args */
50 #define CONFIG_SYS_BARGSIZE		CONFIG_SYS_CBSIZE
51 #define CONFIG_CMDLINE_EDITING
52 #define CONFIG_AUTO_COMPLETE
53 
54 #define CONFIG_HUSH_INIT_VAR
55 
56 #define CONFIG_SYS_ALT_MEMTEST		/* memory test, takes time */
57 
58 #define CONFIG_SYS_HZ			1000	/* decr. freq: 1 ms ticks */
59 
60 #define CONFIG_BAUDRATE			115200
61 #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 }
62 
63 #define CONFIG_LOADS_ECHO
64 #define CONFIG_SYS_LOADS_BAUD_CHANGE
65 
66 #define CONFIG_SYS_I2C_INIT_BOARD
67 
68 /* Support the IVM EEprom */
69 #define	CONFIG_SYS_IVM_EEPROM_ADR	0x50
70 #define CONFIG_SYS_IVM_EEPROM_MAX_LEN	0x400
71 #define CONFIG_SYS_IVM_EEPROM_PAGE_LEN	0x100
72 
73 #define	CONFIG_SYS_FLASH_PROTECTION
74 
75 /*
76  * BOOTP options
77  */
78 #define CONFIG_BOOTP_BOOTFILESIZE
79 #define CONFIG_BOOTP_BOOTPATH
80 #define CONFIG_BOOTP_GATEWAY
81 #define CONFIG_BOOTP_HOSTNAME
82 
83 /* UBI Support for all Keymile boards */
84 #define CONFIG_CMD_UBI
85 #define CONFIG_RBTREE
86 #define CONFIG_MTD_PARTITIONS
87 #define CONFIG_MTD_DEVICE
88 #define CONFIG_MTD_CONCAT
89 
90 #define CONFIG_CMD_CRAMFS
91 #define CONFIG_CRAMFS_CMDLINE
92 
93 #ifndef CONFIG_KM_DEF_ENV_BOOTPARAMS
94 #define CONFIG_KM_DEF_ENV_BOOTPARAMS \
95 	"actual_bank=0\0"
96 #endif
97 
98 #ifndef CONFIG_KM_DEF_NETDEV
99 #define CONFIG_KM_DEF_NETDEV	\
100 	"netdev=eth0\0"
101 #endif
102 
103 #ifndef CONFIG_KM_UBI_PARTITION_NAME_BOOT
104 #define CONFIG_KM_UBI_PARTITION_NAME_BOOT	"ubi0"
105 #endif /* CONFIG_KM_UBI_PARTITION_NAME_BOOT */
106 
107 #ifndef CONFIG_KM_UBI_PARTITION_NAME_APP
108 /* one flash chip only called boot */
109 /* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
110 # define CONFIG_KM_UBI_LINUX_MTD					\
111 	"ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT
112 # define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI				\
113 	"ubiattach=ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "\0"
114 #else /* CONFIG_KM_UBI_PARTITION_NAME_APP */
115 /* two flash chips called boot and app */
116 /* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
117 /* app:  CONFIG_KM_UBI_PARTITION_NAME_APP */
118 # define CONFIG_KM_UBI_LINUX_MTD					\
119 	"ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT " "		\
120 	"ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_APP
121 # define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI				\
122 	"ubiattach=if test ${boot_bank} -eq 0; then; "			\
123 	"ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "; else; "	\
124 	"ubi part " CONFIG_KM_UBI_PARTITION_NAME_APP "; fi\0"
125 #endif /* CONFIG_KM_UBI_PARTITION_NAME_APP */
126 
127 #ifdef CONFIG_NAND_ECC_BCH
128 #define CONFIG_KM_UIMAGE_NAME "ecc_bch_uImage\0"
129 #define CONFIG_KM_ECC_MODE    " eccmode=bch"
130 #else
131 #define CONFIG_KM_UIMAGE_NAME "uImage\0"
132 #define CONFIG_KM_ECC_MODE
133 #endif
134 
135 /*
136  * boottargets
137  * - set 'subbootcmds'
138  * - set 'bootcmd' and 'altbootcmd'
139  * available targets:
140  * - 'release': for a standalone system		kernel/rootfs from flash
141  */
142 #define CONFIG_KM_DEF_ENV_BOOTTARGETS					\
143 	"subbootcmds=ubiattach ubicopy cramfsloadfdt cramfsloadkernel "	\
144 		"flashargs add_default addpanic boot\0"			\
145 	"develop="							\
146 		"tftp 200000 scripts/develop-${arch}.txt && "		\
147 		"env import -t 200000 ${filesize} && "			\
148 		"run setup_debug_env\0"					\
149 	"ramfs="							\
150 		"tftp 200000 scripts/ramfs-${arch}.txt && "		\
151 		"env import -t 200000 ${filesize} && "			\
152 		"run setup_debug_env\0"					\
153 	""
154 
155 /*
156  * bootargs
157  * - modify 'bootargs'
158  *
159  * - 'add_default': default bootargs common for all arm/ppc boards
160  * - 'addpanic': add kernel panic options
161  * - 'flashargs': defaults arguments for flash base boot
162  *
163  */
164 #define CONFIG_KM_DEF_ENV_BOOTARGS					\
165 	"add_default="							\
166 		"setenv bootargs ${bootargs} "				\
167 		"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}"	\
168 		":${hostname}:${netdev}:off:"				\
169 		" console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}"	\
170 		" mem=${kernelmem} init=${init}"			\
171 		CONFIG_KM_ECC_MODE					\
172 		" phram.phram=phvar,${varaddr}," __stringify(CONFIG_KM_PHRAM)\
173 		" " CONFIG_KM_UBI_LINUX_MTD " "				\
174 		CONFIG_KM_DEF_BOOT_ARGS_CPU				\
175 		"\0"							\
176 	"addpanic="							\
177 		"setenv bootargs ${bootargs} panic=1 panic_on_oops=1\0"	\
178 	"flashargs="							\
179 		"setenv bootargs "					\
180 		"root=mtdblock:rootfs${boot_bank} "			\
181 		"rootfstype=squashfs ro\0"				\
182 	""
183 
184 /*
185  * flash_boot
186  * - commands for booting from flash
187  *
188  * - 'cramfsloadkernel': copy kernel from a cramfs to ram
189  * - 'ubiattach': attach ubi partition
190  * - 'ubicopy': copy ubi volume to ram
191  *              - volume names: bootfs0, bootfs1, bootfs2, ...
192  *
193  * processor specific settings
194  * - 'cramfsloadfdt': copy fdt from a cramfs to ram
195  */
196 #define CONFIG_KM_DEF_ENV_FLASH_BOOT					\
197 	"cramfsaddr=" __stringify(CONFIG_KM_CRAMFS_ADDR) "\0"		\
198 	"cramfsloadkernel=cramfsload ${load_addr_r} ${uimage}\0"	\
199 	"ubicopy=ubi read "__stringify(CONFIG_KM_CRAMFS_ADDR)		\
200 			" bootfs${boot_bank}\0"				\
201 	"uimage=" CONFIG_KM_UIMAGE_NAME					\
202 	CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI
203 
204 /*
205  * constants
206  * - KM specific constants and commands
207  *
208  * - 'default': setup default environment
209  */
210 #define CONFIG_KM_DEF_ENV_CONSTANTS					\
211 	"backup_bank=0\0"						\
212 	"release=run newenv; reset\0"					\
213 	"pnvramsize=" __stringify(CONFIG_KM_PNVRAM) "\0"		\
214 	"testbootcmd=setenv boot_bank ${test_bank}; "			\
215 		"run ${subbootcmds}; reset\0"				\
216 	""
217 
218 #ifndef CONFIG_KM_DEF_ENV
219 #define CONFIG_KM_DEF_ENV	\
220 	CONFIG_KM_DEF_ENV_BOOTPARAMS					\
221 	CONFIG_KM_DEF_NETDEV						\
222 	CONFIG_KM_DEF_ENV_CPU						\
223 	CONFIG_KM_DEF_ENV_BOOTTARGETS					\
224 	CONFIG_KM_DEF_ENV_BOOTARGS					\
225 	CONFIG_KM_DEF_ENV_FLASH_BOOT					\
226 	CONFIG_KM_DEF_ENV_CONSTANTS					\
227 	"altbootcmd=run bootcmd\0"					\
228 	"bootcmd=km_checkbidhwk &&  "					\
229 		"setenv bootcmd \'if km_checktestboot; then; "          \
230 				"setenv boot_bank ${test_bank}; else; " \
231 				"setenv boot_bank ${actual_bank}; fi;"  \
232 			"run ${subbootcmds}; reset\' && "		\
233 		"setenv altbootcmd \'setenv boot_bank ${backup_bank}; "	\
234 			"run ${subbootcmds}; reset\' && "		\
235 		"saveenv && saveenv && boot\0"				\
236 	"bootlimit=3\0"							\
237 	"init=/sbin/init-overlay.sh\0"					\
238 	"load_addr_r="__stringify(CONFIG_KM_KERNEL_ADDR) "\0"		\
239 	"load=tftpboot ${load_addr_r} ${u-boot}\0"			\
240 	"mtdids=" MTDIDS_DEFAULT "\0"					\
241 	"mtdparts=" MTDPARTS_DEFAULT "\0"				\
242 	""
243 #endif /* CONFIG_KM_DEF_ENV */
244 
245 #define CONFIG_VERSION_VARIABLE	/* include version env variable */
246 
247 #endif /* __CONFIG_KEYMILE_H */
248