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