1 /*
2  * (C) Copyright 2008-2011
3  * Heiko Schocher, DENX Software Engineering, hs@denx.de.
4  *
5  * See file CREDITS for list of people who contributed to this
6  * project.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of
11  * the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21  * MA 02111-1307 USA
22  */
23 
24 #ifndef __CONFIG_KEYMILE_H
25 #define __CONFIG_KEYMILE_H
26 
27 #define CONFIG_BOOTCOUNT_LIMIT
28 
29 /*
30  * Command line configuration.
31  */
32 #include <config_cmd_default.h>
33 
34 #define CONFIG_CMD_ASKENV
35 #define CONFIG_CMD_DHCP
36 #define CONFIG_CMD_DEFAULTENV_VARS
37 #define CONFIG_CMD_ECHO
38 #define CONFIG_CMD_IMMAP
39 #define CONFIG_CMD_MII
40 #define CONFIG_CMD_PING
41 #define CONFIG_CMD_EEPROM
42 #define CONFIG_CMD_I2C
43 #define CONFIG_CMD_JFFS2
44 #define CONFIG_CMD_MTDPARTS
45 #define CONFIG_CMD_SETEXPR
46 
47 #undef	CONFIG_WATCHDOG		/* disable platform specific watchdog */
48 
49 #define CONFIG_BOOTDELAY	2 /* autoboot after 2 seconds */
50 #undef	CONFIG_BOOTARGS		/* the boot command will set bootargs */
51 
52 /*
53  * Miscellaneous configurable options
54  */
55 #define CONFIG_SYS_HUSH_PARSER
56 #define CONFIG_SYS_LONGHELP			/* undef to save memory	  */
57 #define CONFIG_SYS_PROMPT		"=> "	/* Monitor Command Prompt */
58 #if defined(CONFIG_CMD_KGDB)
59 #define CONFIG_SYS_CBSIZE		1024	/* Console I/O Buffer Size */
60 #else
61 #define CONFIG_SYS_CBSIZE		512	/* Console I/O Buffer Size  */
62 #endif
63 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
64 #define CONFIG_SYS_MAXARGS		32 /* max number of command args */
65 #define CONFIG_SYS_BARGSIZE		CONFIG_SYS_CBSIZE
66 #define CONFIG_CMDLINE_EDITING
67 #define CONFIG_AUTO_COMPLETE
68 
69 #define CONFIG_HUSH_INIT_VAR
70 
71 #define CONFIG_SYS_ALT_MEMTEST		/* memory test, takes time */
72 
73 #define CONFIG_SYS_HZ			1000	/* decr. freq: 1 ms ticks */
74 
75 #define CONFIG_BAUDRATE			115200
76 #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 }
77 
78 #define CONFIG_LOADS_ECHO
79 #define CONFIG_SYS_LOADS_BAUD_CHANGE
80 
81 #define CONFIG_I2C_MULTI_BUS
82 #define CONFIG_SYS_MAX_I2C_BUS		1
83 #define CONFIG_SYS_I2C_INIT_BOARD
84 #define CONFIG_I2C_MUX
85 
86 /* Support the IVM EEprom */
87 #define	CONFIG_SYS_IVM_EEPROM_ADR	0x50
88 #define CONFIG_SYS_IVM_EEPROM_MAX_LEN	0x400
89 #define CONFIG_SYS_IVM_EEPROM_PAGE_LEN	0x100
90 
91 #define	CONFIG_SYS_FLASH_PROTECTION
92 
93 /*
94  * BOOTP options
95  */
96 #define CONFIG_BOOTP_BOOTFILESIZE
97 #define CONFIG_BOOTP_BOOTPATH
98 #define CONFIG_BOOTP_GATEWAY
99 #define CONFIG_BOOTP_HOSTNAME
100 
101 #define CONFIG_SYS_MALLOC_LEN		(4 * 1024 * 1024)
102 
103 /* UBI Support for all Keymile boards */
104 #define CONFIG_CMD_UBI
105 #define CONFIG_RBTREE
106 #define CONFIG_MTD_PARTITIONS
107 #define CONFIG_MTD_DEVICE
108 #define CONFIG_MTD_CONCAT
109 
110 #define CONFIG_CMD_CRAMFS
111 #define CONFIG_CRAMFS_CMDLINE
112 
113 #ifndef CONFIG_KM_DEF_ENV_BOOTPARAMS
114 #define CONFIG_KM_DEF_ENV_BOOTPARAMS \
115 	"actual_bank=0\0"
116 #endif
117 
118 #ifndef CONFIG_KM_DEF_NETDEV
119 #define CONFIG_KM_DEF_NETDEV	\
120 	"netdev=eth0\0"
121 #endif
122 
123 #ifndef CONFIG_KM_UBI_PARTITION_NAME_BOOT
124 #define CONFIG_KM_UBI_PARTITION_NAME_BOOT	"ubi0"
125 #endif /* CONFIG_KM_UBI_PARTITION_NAME_BOOT */
126 
127 #ifndef CONFIG_KM_UBI_PARTITION_NAME_APP
128 /* one flash chip only called boot */
129 /* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
130 # define CONFIG_KM_UBI_LINUX_MTD					\
131 	"ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT
132 # define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI				\
133 	"ubiattach=ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "\0"
134 #else /* CONFIG_KM_UBI_PARTITION_NAME_APP */
135 /* two flash chips called boot and app */
136 /* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
137 /* app:  CONFIG_KM_UBI_PARTITION_NAME_APP */
138 # define CONFIG_KM_UBI_LINUX_MTD					\
139 	"ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT " "		\
140 	"ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_APP
141 # define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI				\
142 	"ubiattach=if test ${boot_bank} -eq 0; then; "			\
143 	"ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "; else; "	\
144 	"ubi part " CONFIG_KM_UBI_PARTITION_NAME_APP "; fi\0"
145 #endif /* CONFIG_KM_UBI_PARTITION_NAME_APP */
146 
147 #ifdef CONFIG_NAND_ECC_BCH
148 #define CONFIG_KM_UIMAGE_NAME "ecc_bch_uImage\0"
149 #define CONFIG_KM_ECC_MODE    " eccmode=bch"
150 #else
151 #define CONFIG_KM_UIMAGE_NAME "uImage\0"
152 #define CONFIG_KM_ECC_MODE
153 #endif
154 
155 /*
156  * boottargets
157  * - set 'subbootcmds'
158  * - set 'bootcmd' and 'altbootcmd'
159  * available targets:
160  * - 'release': for a standalone system		kernel/rootfs from flash
161  */
162 #define CONFIG_KM_DEF_ENV_BOOTTARGETS					\
163 	"subbootcmds=ubiattach ubicopy cramfsloadfdt cramfsloadkernel "	\
164 		"flashargs add_default addpanic boot\0"			\
165 	"develop="							\
166 		"tftp 200000 scripts/develop-${arch}.txt && "		\
167 		"env import -t 200000 ${filesize} && "			\
168 		"run setup_debug_env\0"					\
169 	"ramfs="							\
170 		"tftp 200000 scripts/ramfs-${arch}.txt && "		\
171 		"env import -t 200000 ${filesize} && "			\
172 		"run setup_debug_env\0"					\
173 	""
174 
175 /*
176  * bootargs
177  * - modify 'bootargs'
178  *
179  * - 'add_default': default bootargs common for all arm/ppc boards
180  * - 'addpanic': add kernel panic options
181  * - 'flashargs': defaults arguments for flash base boot
182  *
183  */
184 #define CONFIG_KM_DEF_ENV_BOOTARGS					\
185 	"add_default="							\
186 		"setenv bootargs ${bootargs} "				\
187 		"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}"	\
188 		":${hostname}:${netdev}:off3"				\
189 		" console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}"	\
190 		" mem=${kernelmem} init=${init}"			\
191 		CONFIG_KM_ECC_MODE					\
192 		" phram.phram=phvar,${varaddr}," __stringify(CONFIG_KM_PHRAM)\
193 		" " CONFIG_KM_UBI_LINUX_MTD " "				\
194 		CONFIG_KM_DEF_BOOT_ARGS_CPU				\
195 		"\0"							\
196 	"addpanic="							\
197 		"setenv bootargs ${bootargs} panic=1 panic_on_oops=1\0"	\
198 	"flashargs="							\
199 		"setenv bootargs "					\
200 		"root=mtdblock:rootfs${boot_bank} "			\
201 		"rootfstype=squashfs ro\0"				\
202 	""
203 
204 /*
205  * flash_boot
206  * - commands for booting from flash
207  *
208  * - 'cramfsloadkernel': copy kernel from a cramfs to ram
209  * - 'ubiattach': attach ubi partition
210  * - 'ubicopy': copy ubi volume to ram
211  *              - volume names: bootfs0, bootfs1, bootfs2, ...
212  *
213  * processor specific settings
214  * - 'cramfsloadfdt': copy fdt from a cramfs to ram
215  */
216 #define CONFIG_KM_DEF_ENV_FLASH_BOOT					\
217 	"cramfsaddr=" __stringify(CONFIG_KM_CRAMFS_ADDR) "\0"		\
218 	"cramfsloadkernel=cramfsload ${load_addr_r} ${uimage}\0"	\
219 	"ubicopy=ubi read "__stringify(CONFIG_KM_CRAMFS_ADDR)		\
220 			" bootfs${boot_bank}\0"				\
221 	"uimage=" CONFIG_KM_UIMAGE_NAME					\
222 	CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI
223 
224 /*
225  * constants
226  * - KM specific constants and commands
227  *
228  * - 'default': setup default environment
229  */
230 #define CONFIG_KM_DEF_ENV_CONSTANTS					\
231 	"backup_bank=0\0"						\
232 	"release=run newenv; reset\0"					\
233 	"pnvramsize=" __stringify(CONFIG_KM_PNVRAM) "\0"		\
234 	"testbootcmd=setenv boot_bank ${test_bank}; "			\
235 		"run ${subbootcmds}; reset\0"				\
236 	""
237 
238 #ifndef CONFIG_KM_DEF_ENV
239 #define CONFIG_KM_DEF_ENV	\
240 	CONFIG_KM_DEF_ENV_BOOTPARAMS					\
241 	CONFIG_KM_DEF_NETDEV						\
242 	CONFIG_KM_DEF_ENV_CPU						\
243 	CONFIG_KM_DEF_ENV_BOOTTARGETS					\
244 	CONFIG_KM_DEF_ENV_BOOTARGS					\
245 	CONFIG_KM_DEF_ENV_FLASH_BOOT					\
246 	CONFIG_KM_DEF_ENV_CONSTANTS					\
247 	"altbootcmd=run bootcmd\0"					\
248 	"bootcmd=km_checkbidhwk &&  "					\
249 		"setenv bootcmd \'if km_checktestboot; then; "          \
250 				"setenv boot_bank ${test_bank}; else; " \
251 				"setenv boot_bank ${actual_bank}; fi;"  \
252 			"run ${subbootcmds}; reset\' && "		\
253 		"setenv altbootcmd \'setenv boot_bank ${backup_bank}; "	\
254 			"run ${subbootcmds}; reset\' && "		\
255 		"saveenv && saveenv && boot\0"				\
256 	"bootlimit=3\0"							\
257 	"init=/sbin/init-overlay.sh\0"					\
258 	"load_addr_r="__stringify(CONFIG_KM_KERNEL_ADDR) "\0"		\
259 	"load=tftpboot ${load_addr_r} ${u-boot}\0"			\
260 	"mtdids=" MTDIDS_DEFAULT "\0"					\
261 	"mtdparts=" MTDPARTS_DEFAULT "\0"				\
262 	""
263 #endif /* CONFIG_KM_DEF_ENV */
264 
265 #define CONFIG_VERSION_VARIABLE	/* include version env variable */
266 
267 #endif /* __CONFIG_KEYMILE_H */
268