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