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