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