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_ALT_MEMTEST /* memory test, takes time */
28 #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 }
30 #define CONFIG_LOADS_ECHO
31 #define CONFIG_SYS_LOADS_BAUD_CHANGE
34 /* Support the IVM EEprom */
35 #define CONFIG_SYS_IVM_EEPROM_ADR 0x50
36 #define CONFIG_SYS_IVM_EEPROM_MAX_LEN 0x400
37 #define CONFIG_SYS_IVM_EEPROM_PAGE_LEN 0x100
39 #define CONFIG_SYS_FLASH_PROTECTION
44 #define CONFIG_BOOTP_BOOTFILESIZE
46 /* UBI Support for all Keymile boards */
47 #define CONFIG_MTD_PARTITIONS
48 #define CONFIG_MTD_DEVICE
49 #define CONFIG_MTD_CONCAT
51 #ifndef CONFIG_KM_DEF_ENV_BOOTPARAMS
52 #define CONFIG_KM_DEF_ENV_BOOTPARAMS \
56 #ifndef CONFIG_KM_DEF_NETDEV
57 #define CONFIG_KM_DEF_NETDEV \
61 #ifndef CONFIG_KM_UBI_PARTITION_NAME_BOOT
62 #define CONFIG_KM_UBI_PARTITION_NAME_BOOT "ubi0"
63 #endif /* CONFIG_KM_UBI_PARTITION_NAME_BOOT */
65 #ifndef CONFIG_KM_UBI_PART_BOOT_OPTS
66 #define CONFIG_KM_UBI_PART_BOOT_OPTS ""
67 #endif /* CONFIG_KM_UBI_PART_BOOT_OPTS */
69 #ifndef CONFIG_KM_UBI_PARTITION_NAME_APP
70 /* one flash chip only called boot */
71 /* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
72 # define CONFIG_KM_UBI_LINUX_MTD \
73 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT \
74 CONFIG_KM_UBI_PART_BOOT_OPTS
75 # define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI \
76 "ubiattach=ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "\0"
77 #else /* CONFIG_KM_UBI_PARTITION_NAME_APP */
78 /* two flash chips called boot and app */
79 /* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
80 /* app: CONFIG_KM_UBI_PARTITION_NAME_APP */
81 # define CONFIG_KM_UBI_LINUX_MTD \
82 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT \
83 CONFIG_KM_UBI_PART_BOOT_OPTS " " \
84 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_APP
85 # define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI \
86 "ubiattach=if test ${boot_bank} -eq 0; then; " \
87 "ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "; else; " \
88 "ubi part " CONFIG_KM_UBI_PARTITION_NAME_APP "; fi\0"
89 #endif /* CONFIG_KM_UBI_PARTITION_NAME_APP */
91 #ifdef CONFIG_NAND_ECC_BCH
92 #define CONFIG_KM_UIMAGE_NAME "ecc_bch_uImage\0"
93 #define CONFIG_KM_ECC_MODE " eccmode=bch"
95 #define CONFIG_KM_UIMAGE_NAME "uImage\0"
96 #define CONFIG_KM_ECC_MODE
101 * - set 'subbootcmds'
102 * - set 'bootcmd' and 'altbootcmd'
104 * - 'release': for a standalone system kernel/rootfs from flash
106 #define CONFIG_KM_DEF_ENV_BOOTTARGETS \
107 "subbootcmds=ubiattach ubicopy checkfdt cramfsloadfdt " \
108 "set_fdthigh cramfsloadkernel flashargs add_default " \
111 "tftp 200000 scripts/develop-${arch}.txt && " \
112 "env import -t 200000 ${filesize} && " \
113 "run setup_debug_env\0" \
115 "tftp 200000 scripts/ramfs-${arch}.txt && " \
116 "env import -t 200000 ${filesize} && " \
117 "run setup_debug_env\0" \
122 * - modify 'bootargs'
124 * - 'add_default': default bootargs common for all arm/ppc boards
125 * - 'addpanic': add kernel panic options
126 * - 'flashargs': defaults arguments for flash base boot
129 #define CONFIG_KM_DEF_ENV_BOOTARGS \
131 "setenv bootargs ${bootargs} " \
132 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
133 ":${hostname}:${netdev}:off:" \
134 " console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}" \
135 " mem=${kernelmem} init=${init}" \
137 " phram.phram=phvar,${varaddr}," __stringify(CONFIG_KM_PHRAM)\
138 " " CONFIG_KM_UBI_LINUX_MTD " " \
139 CONFIG_KM_DEF_BOOT_ARGS_CPU \
142 "setenv bootargs ${bootargs} panic=1 panic_on_oops=1\0" \
145 "root=mtdblock:rootfs${boot_bank} " \
146 "rootfstype=squashfs ro\0" \
151 * - commands for booting from flash
153 * - 'cramfsloadkernel': copy kernel from a cramfs to ram
154 * - 'ubiattach': attach ubi partition
155 * - 'ubicopy': copy ubi volume to ram
156 * - volume names: bootfs0, bootfs1, bootfs2, ...
158 * processor specific settings
159 * - 'cramfsloadfdt': copy fdt from a cramfs to ram
161 #define CONFIG_KM_DEF_ENV_FLASH_BOOT \
162 "cramfsaddr=" __stringify(CONFIG_KM_CRAMFS_ADDR) "\0" \
163 "cramfsloadkernel=cramfsload ${load_addr_r} ${uimage}\0" \
164 "ubicopy=ubi read "__stringify(CONFIG_KM_CRAMFS_ADDR) \
165 " bootfs${boot_bank}\0" \
166 "uimage=" CONFIG_KM_UIMAGE_NAME \
167 CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI
171 * - KM specific constants and commands
173 * - 'default': setup default environment
175 #define CONFIG_KM_DEF_ENV_CONSTANTS \
177 "release=run newenv; reset\0" \
178 "pnvramsize=" __stringify(CONFIG_KM_PNVRAM) "\0" \
179 "testbootcmd=setenv boot_bank ${test_bank}; " \
180 "run ${subbootcmds}; reset\0" \
183 #ifndef CONFIG_KM_DEF_ENV
184 #define CONFIG_KM_DEF_ENV \
185 CONFIG_KM_DEF_ENV_BOOTPARAMS \
186 CONFIG_KM_DEF_NETDEV \
187 CONFIG_KM_DEF_ENV_CPU \
188 CONFIG_KM_DEF_ENV_BOOTTARGETS \
189 CONFIG_KM_DEF_ENV_BOOTARGS \
190 CONFIG_KM_DEF_ENV_FLASH_BOOT \
191 CONFIG_KM_DEF_ENV_CONSTANTS \
192 "altbootcmd=run bootcmd\0" \
193 "boot=bootm ${load_addr_r} - ${fdt_addr_r}\0" \
194 "bootcmd=km_checkbidhwk && " \
195 "setenv bootcmd \'if km_checktestboot; then; " \
196 "setenv boot_bank ${test_bank}; else; " \
197 "setenv boot_bank ${actual_bank}; fi;" \
198 "run ${subbootcmds}; reset\' && " \
199 "setenv altbootcmd \'setenv boot_bank ${backup_bank}; " \
200 "run ${subbootcmds}; reset\' && " \
201 "saveenv && saveenv && boot\0" \
204 "cramfsload ${fdt_addr_r} " \
205 "fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb\0" \
206 "fdt_addr_r="__stringify(CONFIG_KM_FDT_ADDR) "\0" \
207 "init=/sbin/init-overlay.sh\0" \
208 "load_addr_r="__stringify(CONFIG_KM_KERNEL_ADDR) "\0" \
209 "load=tftpboot ${load_addr_r} ${u-boot}\0" \
210 "mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \
211 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
213 #endif /* CONFIG_KM_DEF_ENV */
215 #endif /* __CONFIG_KEYMILE_H */