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