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