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