treewide: Migrate CONFIG_SYS_ALT_MEMTEST 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 #undef  CONFIG_WATCHDOG         /* disable platform specific watchdog */
12
13 /*
14  * Miscellaneous configurable options
15  */
16 #if defined(CONFIG_CMD_KGDB)
17 #define CONFIG_SYS_CBSIZE               1024    /* Console I/O Buffer Size */
18 #else
19 #define CONFIG_SYS_CBSIZE               512     /* Console I/O Buffer Size  */
20 #endif
21 #define CONFIG_SYS_MAXARGS              32 /* max number of command args */
22 #define CONFIG_SYS_BARGSIZE             CONFIG_SYS_CBSIZE
23
24 #define CONFIG_HUSH_INIT_VAR
25
26 #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 }
27
28 #define CONFIG_LOADS_ECHO
29 #define CONFIG_SYS_LOADS_BAUD_CHANGE
30
31
32 /* Support the IVM EEprom */
33 #define CONFIG_SYS_IVM_EEPROM_ADR       0x50
34 #define CONFIG_SYS_IVM_EEPROM_MAX_LEN   0x400
35 #define CONFIG_SYS_IVM_EEPROM_PAGE_LEN  0x100
36
37 #define CONFIG_SYS_FLASH_PROTECTION
38
39 /*
40  * BOOTP options
41  */
42 #define CONFIG_BOOTP_BOOTFILESIZE
43
44 /* UBI Support for all Keymile boards */
45 #define CONFIG_MTD_PARTITIONS
46 #define CONFIG_MTD_DEVICE
47 #define CONFIG_MTD_CONCAT
48
49 #ifndef CONFIG_KM_DEF_ENV_BOOTPARAMS
50 #define CONFIG_KM_DEF_ENV_BOOTPARAMS \
51         "actual_bank=0\0"
52 #endif
53
54 #ifndef CONFIG_KM_DEF_NETDEV
55 #define CONFIG_KM_DEF_NETDEV    \
56         "netdev=eth0\0"
57 #endif
58
59 #ifndef CONFIG_KM_UBI_PARTITION_NAME_BOOT
60 #define CONFIG_KM_UBI_PARTITION_NAME_BOOT       "ubi0"
61 #endif /* CONFIG_KM_UBI_PARTITION_NAME_BOOT */
62
63 #ifndef CONFIG_KM_UBI_PART_BOOT_OPTS
64 #define CONFIG_KM_UBI_PART_BOOT_OPTS            ""
65 #endif /* CONFIG_KM_UBI_PART_BOOT_OPTS */
66
67 #ifndef CONFIG_KM_UBI_PARTITION_NAME_APP
68 /* one flash chip only called boot */
69 /* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
70 # define CONFIG_KM_UBI_LINUX_MTD                                        \
71         "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT                    \
72         CONFIG_KM_UBI_PART_BOOT_OPTS
73 # define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI                               \
74         "ubiattach=ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "\0"
75 #else /* CONFIG_KM_UBI_PARTITION_NAME_APP */
76 /* two flash chips called boot and app */
77 /* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
78 /* app:  CONFIG_KM_UBI_PARTITION_NAME_APP */
79 # define CONFIG_KM_UBI_LINUX_MTD                                        \
80         "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT                    \
81         CONFIG_KM_UBI_PART_BOOT_OPTS " "                                \
82         "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_APP
83 # define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI                               \
84         "ubiattach=if test ${boot_bank} -eq 0; then; "                  \
85         "ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "; else; "        \
86         "ubi part " CONFIG_KM_UBI_PARTITION_NAME_APP "; fi\0"
87 #endif /* CONFIG_KM_UBI_PARTITION_NAME_APP */
88
89 #ifdef CONFIG_NAND_ECC_BCH
90 #define CONFIG_KM_UIMAGE_NAME "ecc_bch_uImage\0"
91 #define CONFIG_KM_ECC_MODE    " eccmode=bch"
92 #else
93 #define CONFIG_KM_UIMAGE_NAME "uImage\0"
94 #define CONFIG_KM_ECC_MODE
95 #endif
96
97 /*
98  * boottargets
99  * - set 'subbootcmds'
100  * - set 'bootcmd' and 'altbootcmd'
101  * available targets:
102  * - 'release': for a standalone system         kernel/rootfs from flash
103  */
104 #define CONFIG_KM_DEF_ENV_BOOTTARGETS                                   \
105         "subbootcmds=ubiattach ubicopy checkfdt cramfsloadfdt "         \
106                 "set_fdthigh cramfsloadkernel flashargs add_default "   \
107                 "addpanic boot\0"                                       \
108         "develop="                                                      \
109                 "tftp 200000 scripts/develop-${arch}.txt && "           \
110                 "env import -t 200000 ${filesize} && "                  \
111                 "run setup_debug_env\0"                                 \
112         "ramfs="                                                        \
113                 "tftp 200000 scripts/ramfs-${arch}.txt && "             \
114                 "env import -t 200000 ${filesize} && "                  \
115                 "run setup_debug_env\0"                                 \
116         ""
117
118 /*
119  * bootargs
120  * - modify 'bootargs'
121  *
122  * - 'add_default': default bootargs common for all arm/ppc boards
123  * - 'addpanic': add kernel panic options
124  * - 'flashargs': defaults arguments for flash base boot
125  *
126  */
127 #define CONFIG_KM_DEF_ENV_BOOTARGS                                      \
128         "add_default="                                                  \
129                 "setenv bootargs ${bootargs} "                          \
130                 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}"      \
131                 ":${hostname}:${netdev}:off:"                           \
132                 " console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}"        \
133                 " mem=${kernelmem} init=${init}"                        \
134                 CONFIG_KM_ECC_MODE                                      \
135                 " phram.phram=phvar,${varaddr}," __stringify(CONFIG_KM_PHRAM)\
136                 " " CONFIG_KM_UBI_LINUX_MTD " "                         \
137                 CONFIG_KM_DEF_BOOT_ARGS_CPU                             \
138                 "\0"                                                    \
139         "addpanic="                                                     \
140                 "setenv bootargs ${bootargs} panic=1 panic_on_oops=1\0" \
141         "flashargs="                                                    \
142                 "setenv bootargs "                                      \
143                 "root=mtdblock:rootfs${boot_bank} "                     \
144                 "rootfstype=squashfs ro\0"                              \
145         ""
146
147 /*
148  * flash_boot
149  * - commands for booting from flash
150  *
151  * - 'cramfsloadkernel': copy kernel from a cramfs to ram
152  * - 'ubiattach': attach ubi partition
153  * - 'ubicopy': copy ubi volume to ram
154  *              - volume names: bootfs0, bootfs1, bootfs2, ...
155  *
156  * processor specific settings
157  * - 'cramfsloadfdt': copy fdt from a cramfs to ram
158  */
159 #define CONFIG_KM_DEF_ENV_FLASH_BOOT                                    \
160         "cramfsaddr=" __stringify(CONFIG_KM_CRAMFS_ADDR) "\0"           \
161         "cramfsloadkernel=cramfsload ${load_addr_r} ${uimage}\0"        \
162         "ubicopy=ubi read "__stringify(CONFIG_KM_CRAMFS_ADDR)           \
163                         " bootfs${boot_bank}\0"                         \
164         "uimage=" CONFIG_KM_UIMAGE_NAME                                 \
165         CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI
166
167 /*
168  * constants
169  * - KM specific constants and commands
170  *
171  * - 'default': setup default environment
172  */
173 #define CONFIG_KM_DEF_ENV_CONSTANTS                                     \
174         "backup_bank=0\0"                                               \
175         "release=run newenv; reset\0"                                   \
176         "pnvramsize=" __stringify(CONFIG_KM_PNVRAM) "\0"                \
177         "testbootcmd=setenv boot_bank ${test_bank}; "                   \
178                 "run ${subbootcmds}; reset\0"                           \
179         ""
180
181 #ifndef CONFIG_KM_DEF_ENV
182 #define CONFIG_KM_DEF_ENV       \
183         CONFIG_KM_DEF_ENV_BOOTPARAMS                                    \
184         CONFIG_KM_DEF_NETDEV                                            \
185         CONFIG_KM_DEF_ENV_CPU                                           \
186         CONFIG_KM_DEF_ENV_BOOTTARGETS                                   \
187         CONFIG_KM_DEF_ENV_BOOTARGS                                      \
188         CONFIG_KM_DEF_ENV_FLASH_BOOT                                    \
189         CONFIG_KM_DEF_ENV_CONSTANTS                                     \
190         "altbootcmd=run bootcmd\0"                                      \
191         "boot=bootm ${load_addr_r} - ${fdt_addr_r}\0"                   \
192         "bootcmd=km_checkbidhwk &&  "                                   \
193                 "setenv bootcmd \'if km_checktestboot; then; "          \
194                                 "setenv boot_bank ${test_bank}; else; " \
195                                 "setenv boot_bank ${actual_bank}; fi;"  \
196                         "run ${subbootcmds}; reset\' && "               \
197                 "setenv altbootcmd \'setenv boot_bank ${backup_bank}; " \
198                         "run ${subbootcmds}; reset\' && "               \
199                 "saveenv && saveenv && boot\0"                          \
200         "bootlimit=3\0"                                                 \
201         "cramfsloadfdt="                                                \
202                 "cramfsload ${fdt_addr_r} "                             \
203                 "fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb\0"             \
204         "fdt_addr_r="__stringify(CONFIG_KM_FDT_ADDR) "\0"               \
205         "init=/sbin/init-overlay.sh\0"                                  \
206         "load_addr_r="__stringify(CONFIG_KM_KERNEL_ADDR) "\0"           \
207         "load=tftpboot ${load_addr_r} ${u-boot}\0"                      \
208         "mtdids=" CONFIG_MTDIDS_DEFAULT "\0"                                    \
209         "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0"                                \
210         ""
211 #endif /* CONFIG_KM_DEF_ENV */
212
213 #endif /* __CONFIG_KEYMILE_H */