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