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