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