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