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