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