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