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