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