1 /* 2 * (C) Copyright 2008-2011 3 * Heiko Schocher, DENX Software Engineering, hs@denx.de. 4 * 5 * SPDX-License-Identifier: GPL-2.0+ 6 */ 7 8 #ifndef __CONFIG_KEYMILE_H 9 #define __CONFIG_KEYMILE_H 10 11 #define CONFIG_BOOTCOUNT_LIMIT 12 13 /* 14 * Command line configuration. 15 */ 16 #define CONFIG_CMD_ASKENV 17 #define CONFIG_CMD_DEFAULTENV_VARS 18 #define CONFIG_CMD_GREPENV 19 #define CONFIG_CMD_IMMAP 20 #define CONFIG_CMD_MII 21 #define CONFIG_CMD_EEPROM 22 #define CONFIG_CMD_JFFS2 23 #define CONFIG_CMD_MTDPARTS 24 25 #undef CONFIG_WATCHDOG /* disable platform specific watchdog */ 26 27 #define CONFIG_BOOTDELAY 2 /* autoboot after 2 seconds */ 28 #undef CONFIG_BOOTARGS /* the boot command will set bootargs */ 29 30 /* 31 * Miscellaneous configurable options 32 */ 33 #define CONFIG_SYS_LONGHELP /* undef to save memory */ 34 #if defined(CONFIG_CMD_KGDB) 35 #define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */ 36 #else 37 #define CONFIG_SYS_CBSIZE 512 /* Console I/O Buffer Size */ 38 #endif 39 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16) 40 #define CONFIG_SYS_MAXARGS 32 /* max number of command args */ 41 #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE 42 #define CONFIG_CMDLINE_EDITING 43 #define CONFIG_AUTO_COMPLETE 44 45 #define CONFIG_HUSH_INIT_VAR 46 47 #define CONFIG_SYS_ALT_MEMTEST /* memory test, takes time */ 48 49 #define CONFIG_BAUDRATE 115200 50 #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 } 51 52 #define CONFIG_LOADS_ECHO 53 #define CONFIG_SYS_LOADS_BAUD_CHANGE 54 55 56 /* Support the IVM EEprom */ 57 #define CONFIG_SYS_IVM_EEPROM_ADR 0x50 58 #define CONFIG_SYS_IVM_EEPROM_MAX_LEN 0x400 59 #define CONFIG_SYS_IVM_EEPROM_PAGE_LEN 0x100 60 61 #define CONFIG_SYS_FLASH_PROTECTION 62 63 /* 64 * BOOTP options 65 */ 66 #define CONFIG_BOOTP_BOOTFILESIZE 67 #define CONFIG_BOOTP_BOOTPATH 68 #define CONFIG_BOOTP_GATEWAY 69 #define CONFIG_BOOTP_HOSTNAME 70 71 /* UBI Support for all Keymile boards */ 72 #define CONFIG_CMD_UBI 73 #define CONFIG_RBTREE 74 #define CONFIG_MTD_PARTITIONS 75 #define CONFIG_MTD_DEVICE 76 #define CONFIG_MTD_CONCAT 77 78 #define CONFIG_CMD_CRAMFS 79 80 #ifndef CONFIG_KM_DEF_ENV_BOOTPARAMS 81 #define CONFIG_KM_DEF_ENV_BOOTPARAMS \ 82 "actual_bank=0\0" 83 #endif 84 85 #ifndef CONFIG_KM_DEF_NETDEV 86 #define CONFIG_KM_DEF_NETDEV \ 87 "netdev=eth0\0" 88 #endif 89 90 #ifndef CONFIG_KM_UBI_PARTITION_NAME_BOOT 91 #define CONFIG_KM_UBI_PARTITION_NAME_BOOT "ubi0" 92 #endif /* CONFIG_KM_UBI_PARTITION_NAME_BOOT */ 93 94 #ifndef CONFIG_KM_UBI_PART_BOOT_OPTS 95 #define CONFIG_KM_UBI_PART_BOOT_OPTS "" 96 #endif /* CONFIG_KM_UBI_PART_BOOT_OPTS */ 97 98 #ifndef CONFIG_KM_UBI_PARTITION_NAME_APP 99 /* one flash chip only called boot */ 100 /* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */ 101 # define CONFIG_KM_UBI_LINUX_MTD \ 102 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT \ 103 CONFIG_KM_UBI_PART_BOOT_OPTS 104 # define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI \ 105 "ubiattach=ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "\0" 106 #else /* CONFIG_KM_UBI_PARTITION_NAME_APP */ 107 /* two flash chips called boot and app */ 108 /* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */ 109 /* app: CONFIG_KM_UBI_PARTITION_NAME_APP */ 110 # define CONFIG_KM_UBI_LINUX_MTD \ 111 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT \ 112 CONFIG_KM_UBI_PART_BOOT_OPTS " " \ 113 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_APP 114 # define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI \ 115 "ubiattach=if test ${boot_bank} -eq 0; then; " \ 116 "ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "; else; " \ 117 "ubi part " CONFIG_KM_UBI_PARTITION_NAME_APP "; fi\0" 118 #endif /* CONFIG_KM_UBI_PARTITION_NAME_APP */ 119 120 #ifdef CONFIG_NAND_ECC_BCH 121 #define CONFIG_KM_UIMAGE_NAME "ecc_bch_uImage\0" 122 #define CONFIG_KM_ECC_MODE " eccmode=bch" 123 #else 124 #define CONFIG_KM_UIMAGE_NAME "uImage\0" 125 #define CONFIG_KM_ECC_MODE 126 #endif 127 128 /* 129 * boottargets 130 * - set 'subbootcmds' 131 * - set 'bootcmd' and 'altbootcmd' 132 * available targets: 133 * - 'release': for a standalone system kernel/rootfs from flash 134 */ 135 #define CONFIG_KM_DEF_ENV_BOOTTARGETS \ 136 "subbootcmds=ubiattach ubicopy checkfdt cramfsloadfdt " \ 137 "set_fdthigh cramfsloadkernel flashargs add_default " \ 138 "addpanic boot\0" \ 139 "develop=" \ 140 "tftp 200000 scripts/develop-${arch}.txt && " \ 141 "env import -t 200000 ${filesize} && " \ 142 "run setup_debug_env\0" \ 143 "ramfs=" \ 144 "tftp 200000 scripts/ramfs-${arch}.txt && " \ 145 "env import -t 200000 ${filesize} && " \ 146 "run setup_debug_env\0" \ 147 "" 148 149 /* 150 * bootargs 151 * - modify 'bootargs' 152 * 153 * - 'add_default': default bootargs common for all arm/ppc boards 154 * - 'addpanic': add kernel panic options 155 * - 'flashargs': defaults arguments for flash base boot 156 * 157 */ 158 #define CONFIG_KM_DEF_ENV_BOOTARGS \ 159 "add_default=" \ 160 "setenv bootargs ${bootargs} " \ 161 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \ 162 ":${hostname}:${netdev}:off:" \ 163 " console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}" \ 164 " mem=${kernelmem} init=${init}" \ 165 CONFIG_KM_ECC_MODE \ 166 " phram.phram=phvar,${varaddr}," __stringify(CONFIG_KM_PHRAM)\ 167 " " CONFIG_KM_UBI_LINUX_MTD " " \ 168 CONFIG_KM_DEF_BOOT_ARGS_CPU \ 169 "\0" \ 170 "addpanic=" \ 171 "setenv bootargs ${bootargs} panic=1 panic_on_oops=1\0" \ 172 "flashargs=" \ 173 "setenv bootargs " \ 174 "root=mtdblock:rootfs${boot_bank} " \ 175 "rootfstype=squashfs ro\0" \ 176 "" 177 178 /* 179 * flash_boot 180 * - commands for booting from flash 181 * 182 * - 'cramfsloadkernel': copy kernel from a cramfs to ram 183 * - 'ubiattach': attach ubi partition 184 * - 'ubicopy': copy ubi volume to ram 185 * - volume names: bootfs0, bootfs1, bootfs2, ... 186 * 187 * processor specific settings 188 * - 'cramfsloadfdt': copy fdt from a cramfs to ram 189 */ 190 #define CONFIG_KM_DEF_ENV_FLASH_BOOT \ 191 "cramfsaddr=" __stringify(CONFIG_KM_CRAMFS_ADDR) "\0" \ 192 "cramfsloadkernel=cramfsload ${load_addr_r} ${uimage}\0" \ 193 "ubicopy=ubi read "__stringify(CONFIG_KM_CRAMFS_ADDR) \ 194 " bootfs${boot_bank}\0" \ 195 "uimage=" CONFIG_KM_UIMAGE_NAME \ 196 CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI 197 198 /* 199 * constants 200 * - KM specific constants and commands 201 * 202 * - 'default': setup default environment 203 */ 204 #define CONFIG_KM_DEF_ENV_CONSTANTS \ 205 "backup_bank=0\0" \ 206 "release=run newenv; reset\0" \ 207 "pnvramsize=" __stringify(CONFIG_KM_PNVRAM) "\0" \ 208 "testbootcmd=setenv boot_bank ${test_bank}; " \ 209 "run ${subbootcmds}; reset\0" \ 210 "" 211 212 #ifndef CONFIG_KM_DEF_ENV 213 #define CONFIG_KM_DEF_ENV \ 214 CONFIG_KM_DEF_ENV_BOOTPARAMS \ 215 CONFIG_KM_DEF_NETDEV \ 216 CONFIG_KM_DEF_ENV_CPU \ 217 CONFIG_KM_DEF_ENV_BOOTTARGETS \ 218 CONFIG_KM_DEF_ENV_BOOTARGS \ 219 CONFIG_KM_DEF_ENV_FLASH_BOOT \ 220 CONFIG_KM_DEF_ENV_CONSTANTS \ 221 "altbootcmd=run bootcmd\0" \ 222 "boot=bootm ${load_addr_r} - ${fdt_addr_r}\0" \ 223 "bootcmd=km_checkbidhwk && " \ 224 "setenv bootcmd \'if km_checktestboot; then; " \ 225 "setenv boot_bank ${test_bank}; else; " \ 226 "setenv boot_bank ${actual_bank}; fi;" \ 227 "run ${subbootcmds}; reset\' && " \ 228 "setenv altbootcmd \'setenv boot_bank ${backup_bank}; " \ 229 "run ${subbootcmds}; reset\' && " \ 230 "saveenv && saveenv && boot\0" \ 231 "bootlimit=3\0" \ 232 "cramfsloadfdt=" \ 233 "cramfsload ${fdt_addr_r} " \ 234 "fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb\0" \ 235 "fdt_addr_r="__stringify(CONFIG_KM_FDT_ADDR) "\0" \ 236 "init=/sbin/init-overlay.sh\0" \ 237 "load_addr_r="__stringify(CONFIG_KM_KERNEL_ADDR) "\0" \ 238 "load=tftpboot ${load_addr_r} ${u-boot}\0" \ 239 "mtdids=" MTDIDS_DEFAULT "\0" \ 240 "mtdparts=" MTDPARTS_DEFAULT "\0" \ 241 "" 242 #endif /* CONFIG_KM_DEF_ENV */ 243 244 #define CONFIG_VERSION_VARIABLE /* include version env variable */ 245 246 #endif /* __CONFIG_KEYMILE_H */ 247