xref: /rk3399_rockchip-uboot/include/configs/km/keymile-common.h (revision adad96e60d0eb1bbc4d0b96c89decf385a426e42)
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 #define CONFIG_CMD_ASKENV
17 #define CONFIG_CMD_DHCP
18 #define CONFIG_CMD_DEFAULTENV_VARS
19 #define CONFIG_CMD_GREPENV
20 #define CONFIG_CMD_IMMAP
21 #define CONFIG_CMD_MII
22 #define CONFIG_CMD_PING
23 #define CONFIG_CMD_EEPROM
24 #define CONFIG_CMD_I2C
25 #define CONFIG_CMD_JFFS2
26 #define CONFIG_CMD_MTDPARTS
27 
28 #undef	CONFIG_WATCHDOG		/* disable platform specific watchdog */
29 
30 #define CONFIG_BOOTDELAY	2 /* autoboot after 2 seconds */
31 #undef	CONFIG_BOOTARGS		/* the boot command will set bootargs */
32 
33 /*
34  * Miscellaneous configurable options
35  */
36 #define CONFIG_SYS_LONGHELP			/* undef to save memory	  */
37 #if defined(CONFIG_CMD_KGDB)
38 #define CONFIG_SYS_CBSIZE		1024	/* Console I/O Buffer Size */
39 #else
40 #define CONFIG_SYS_CBSIZE		512	/* Console I/O Buffer Size  */
41 #endif
42 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
43 #define CONFIG_SYS_MAXARGS		32 /* max number of command args */
44 #define CONFIG_SYS_BARGSIZE		CONFIG_SYS_CBSIZE
45 #define CONFIG_CMDLINE_EDITING
46 #define CONFIG_AUTO_COMPLETE
47 
48 #define CONFIG_HUSH_INIT_VAR
49 
50 #define CONFIG_SYS_ALT_MEMTEST		/* memory test, takes time */
51 
52 #define CONFIG_BAUDRATE			115200
53 #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 }
54 
55 #define CONFIG_LOADS_ECHO
56 #define CONFIG_SYS_LOADS_BAUD_CHANGE
57 
58 #define CONFIG_AUTOBOOT_KEYED
59 #define CONFIG_AUTOBOOT_PROMPT "Hit <SPACE> key to stop autoboot in %2ds\n"
60 #define CONFIG_AUTOBOOT_STOP_STR        " "
61 
62 /* Support the IVM EEprom */
63 #define	CONFIG_SYS_IVM_EEPROM_ADR	0x50
64 #define CONFIG_SYS_IVM_EEPROM_MAX_LEN	0x400
65 #define CONFIG_SYS_IVM_EEPROM_PAGE_LEN	0x100
66 
67 #define	CONFIG_SYS_FLASH_PROTECTION
68 
69 /*
70  * BOOTP options
71  */
72 #define CONFIG_BOOTP_BOOTFILESIZE
73 #define CONFIG_BOOTP_BOOTPATH
74 #define CONFIG_BOOTP_GATEWAY
75 #define CONFIG_BOOTP_HOSTNAME
76 
77 /* UBI Support for all Keymile boards */
78 #define CONFIG_CMD_UBI
79 #define CONFIG_RBTREE
80 #define CONFIG_MTD_PARTITIONS
81 #define CONFIG_MTD_DEVICE
82 #define CONFIG_MTD_CONCAT
83 
84 #define CONFIG_CMD_CRAMFS
85 
86 #ifndef CONFIG_KM_DEF_ENV_BOOTPARAMS
87 #define CONFIG_KM_DEF_ENV_BOOTPARAMS \
88 	"actual_bank=0\0"
89 #endif
90 
91 #ifndef CONFIG_KM_DEF_NETDEV
92 #define CONFIG_KM_DEF_NETDEV	\
93 	"netdev=eth0\0"
94 #endif
95 
96 #ifndef CONFIG_KM_UBI_PARTITION_NAME_BOOT
97 #define CONFIG_KM_UBI_PARTITION_NAME_BOOT	"ubi0"
98 #endif /* CONFIG_KM_UBI_PARTITION_NAME_BOOT */
99 
100 #ifndef CONFIG_KM_UBI_PART_BOOT_OPTS
101 #define CONFIG_KM_UBI_PART_BOOT_OPTS		""
102 #endif /* CONFIG_KM_UBI_PART_BOOT_OPTS */
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 	CONFIG_KM_UBI_PART_BOOT_OPTS
110 # define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI				\
111 	"ubiattach=ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "\0"
112 #else /* CONFIG_KM_UBI_PARTITION_NAME_APP */
113 /* two flash chips called boot and app */
114 /* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
115 /* app:  CONFIG_KM_UBI_PARTITION_NAME_APP */
116 # define CONFIG_KM_UBI_LINUX_MTD					\
117 	"ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT			\
118 	CONFIG_KM_UBI_PART_BOOT_OPTS " "				\
119 	"ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_APP
120 # define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI				\
121 	"ubiattach=if test ${boot_bank} -eq 0; then; "			\
122 	"ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "; else; "	\
123 	"ubi part " CONFIG_KM_UBI_PARTITION_NAME_APP "; fi\0"
124 #endif /* CONFIG_KM_UBI_PARTITION_NAME_APP */
125 
126 #ifdef CONFIG_NAND_ECC_BCH
127 #define CONFIG_KM_UIMAGE_NAME "ecc_bch_uImage\0"
128 #define CONFIG_KM_ECC_MODE    " eccmode=bch"
129 #else
130 #define CONFIG_KM_UIMAGE_NAME "uImage\0"
131 #define CONFIG_KM_ECC_MODE
132 #endif
133 
134 /*
135  * boottargets
136  * - set 'subbootcmds'
137  * - set 'bootcmd' and 'altbootcmd'
138  * available targets:
139  * - 'release': for a standalone system		kernel/rootfs from flash
140  */
141 #define CONFIG_KM_DEF_ENV_BOOTTARGETS					\
142 	"subbootcmds=ubiattach ubicopy checkfdt cramfsloadfdt "		\
143 		"set_fdthigh cramfsloadkernel flashargs add_default "	\
144 		"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 	"boot=bootm ${load_addr_r} - ${fdt_addr_r}\0"			\
229 	"bootcmd=km_checkbidhwk &&  "					\
230 		"setenv bootcmd \'if km_checktestboot; then; "          \
231 				"setenv boot_bank ${test_bank}; else; " \
232 				"setenv boot_bank ${actual_bank}; fi;"  \
233 			"run ${subbootcmds}; reset\' && "		\
234 		"setenv altbootcmd \'setenv boot_bank ${backup_bank}; "	\
235 			"run ${subbootcmds}; reset\' && "		\
236 		"saveenv && saveenv && boot\0"				\
237 	"bootlimit=3\0"							\
238 	"cramfsloadfdt="						\
239 		"cramfsload ${fdt_addr_r} "				\
240 		"fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb\0"		\
241 	"fdt_addr_r="__stringify(CONFIG_KM_FDT_ADDR) "\0"		\
242 	"init=/sbin/init-overlay.sh\0"					\
243 	"load_addr_r="__stringify(CONFIG_KM_KERNEL_ADDR) "\0"		\
244 	"load=tftpboot ${load_addr_r} ${u-boot}\0"			\
245 	"mtdids=" MTDIDS_DEFAULT "\0"					\
246 	"mtdparts=" MTDPARTS_DEFAULT "\0"				\
247 	""
248 #endif /* CONFIG_KM_DEF_ENV */
249 
250 #define CONFIG_VERSION_VARIABLE	/* include version env variable */
251 
252 #endif /* __CONFIG_KEYMILE_H */
253