Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Heiko Schocher | 7937e4f | 2008-11-20 09:59:09 +0100 | [diff] [blame] | 2 | /* |
Heiko Schocher | 8ce3dd5 | 2011-03-15 16:52:29 +0100 | [diff] [blame] | 3 | * (C) Copyright 2008-2011 |
Heiko Schocher | 7937e4f | 2008-11-20 09:59:09 +0100 | [diff] [blame] | 4 | * Heiko Schocher, DENX Software Engineering, hs@denx.de. |
Heiko Schocher | 7937e4f | 2008-11-20 09:59:09 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef __CONFIG_KEYMILE_H |
| 8 | #define __CONFIG_KEYMILE_H |
| 9 | |
Simon Glass | fb64e36 | 2020-05-10 11:40:09 -0600 | [diff] [blame] | 10 | #include <linux/stringify.h> |
| 11 | |
Heiko Schocher | 7937e4f | 2008-11-20 09:59:09 +0100 | [diff] [blame] | 12 | /* |
| 13 | * Miscellaneous configurable options |
| 14 | */ |
Heiko Schocher | 7937e4f | 2008-11-20 09:59:09 +0100 | [diff] [blame] | 15 | |
Holger Brunck | 4559d1f | 2011-04-08 02:47:46 +0000 | [diff] [blame] | 16 | #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 } |
Heiko Schocher | 7937e4f | 2008-11-20 09:59:09 +0100 | [diff] [blame] | 17 | |
Holger Brunck | e7c1fdc | 2011-03-04 14:56:27 +0100 | [diff] [blame] | 18 | #ifndef CONFIG_KM_DEF_ENV_BOOTPARAMS |
| 19 | #define CONFIG_KM_DEF_ENV_BOOTPARAMS \ |
Holger Brunck | 2ff59ee | 2011-07-04 21:27:16 +0000 | [diff] [blame] | 20 | "actual_bank=0\0" |
Heiko Schocher | a8d5189 | 2009-03-12 07:37:18 +0100 | [diff] [blame] | 21 | #endif |
| 22 | |
Andreas Huber | a81548a | 2012-05-04 10:30:16 +0200 | [diff] [blame] | 23 | #ifndef CONFIG_KM_UBI_PARTITION_NAME_BOOT |
| 24 | #define CONFIG_KM_UBI_PARTITION_NAME_BOOT "ubi0" |
| 25 | #endif /* CONFIG_KM_UBI_PARTITION_NAME_BOOT */ |
| 26 | |
Valentin Longchamp | e6d848f | 2014-01-27 11:49:10 +0100 | [diff] [blame] | 27 | #ifndef CONFIG_KM_UBI_PART_BOOT_OPTS |
| 28 | #define CONFIG_KM_UBI_PART_BOOT_OPTS "" |
| 29 | #endif /* CONFIG_KM_UBI_PART_BOOT_OPTS */ |
| 30 | |
Andreas Huber | a81548a | 2012-05-04 10:30:16 +0200 | [diff] [blame] | 31 | #ifndef CONFIG_KM_UBI_PARTITION_NAME_APP |
| 32 | /* one flash chip only called boot */ |
| 33 | /* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */ |
| 34 | # define CONFIG_KM_UBI_LINUX_MTD \ |
Valentin Longchamp | e6d848f | 2014-01-27 11:49:10 +0100 | [diff] [blame] | 35 | "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT \ |
| 36 | CONFIG_KM_UBI_PART_BOOT_OPTS |
Andreas Huber | a81548a | 2012-05-04 10:30:16 +0200 | [diff] [blame] | 37 | # define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI \ |
| 38 | "ubiattach=ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "\0" |
| 39 | #else /* CONFIG_KM_UBI_PARTITION_NAME_APP */ |
| 40 | /* two flash chips called boot and app */ |
| 41 | /* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */ |
| 42 | /* app: CONFIG_KM_UBI_PARTITION_NAME_APP */ |
| 43 | # define CONFIG_KM_UBI_LINUX_MTD \ |
Valentin Longchamp | e6d848f | 2014-01-27 11:49:10 +0100 | [diff] [blame] | 44 | "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT \ |
| 45 | CONFIG_KM_UBI_PART_BOOT_OPTS " " \ |
Andreas Huber | a81548a | 2012-05-04 10:30:16 +0200 | [diff] [blame] | 46 | "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_APP |
| 47 | # define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI \ |
| 48 | "ubiattach=if test ${boot_bank} -eq 0; then; " \ |
| 49 | "ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "; else; " \ |
| 50 | "ubi part " CONFIG_KM_UBI_PARTITION_NAME_APP "; fi\0" |
| 51 | #endif /* CONFIG_KM_UBI_PARTITION_NAME_APP */ |
Holger Brunck | 752ba31 | 2011-03-14 16:01:04 +0100 | [diff] [blame] | 52 | |
Andreas Huber | c31a757 | 2013-01-21 03:55:20 +0000 | [diff] [blame] | 53 | #ifdef CONFIG_NAND_ECC_BCH |
| 54 | #define CONFIG_KM_UIMAGE_NAME "ecc_bch_uImage\0" |
Holger Brunck | ffcbb93 | 2013-01-21 03:55:24 +0000 | [diff] [blame] | 55 | #define CONFIG_KM_ECC_MODE " eccmode=bch" |
Andreas Huber | c31a757 | 2013-01-21 03:55:20 +0000 | [diff] [blame] | 56 | #else |
| 57 | #define CONFIG_KM_UIMAGE_NAME "uImage\0" |
Holger Brunck | ffcbb93 | 2013-01-21 03:55:24 +0000 | [diff] [blame] | 58 | #define CONFIG_KM_ECC_MODE |
Andreas Huber | c31a757 | 2013-01-21 03:55:20 +0000 | [diff] [blame] | 59 | #endif |
| 60 | |
Holger Brunck | 752ba31 | 2011-03-14 16:01:04 +0100 | [diff] [blame] | 61 | /* |
Holger Brunck | e7c1fdc | 2011-03-04 14:56:27 +0100 | [diff] [blame] | 62 | * boottargets |
Holger Brunck | 2ff59ee | 2011-07-04 21:27:16 +0000 | [diff] [blame] | 63 | * - set 'subbootcmds' |
Holger Brunck | e7c1fdc | 2011-03-04 14:56:27 +0100 | [diff] [blame] | 64 | * - set 'bootcmd' and 'altbootcmd' |
| 65 | * available targets: |
| 66 | * - 'release': for a standalone system kernel/rootfs from flash |
Holger Brunck | e7c1fdc | 2011-03-04 14:56:27 +0100 | [diff] [blame] | 67 | */ |
| 68 | #define CONFIG_KM_DEF_ENV_BOOTTARGETS \ |
Valentin Longchamp | 15e79cc | 2015-11-13 16:15:20 +0100 | [diff] [blame] | 69 | "subbootcmds=ubiattach ubicopy checkfdt cramfsloadfdt " \ |
| 70 | "set_fdthigh cramfsloadkernel flashargs add_default " \ |
| 71 | "addpanic boot\0" \ |
Holger Brunck | e7bec9b | 2011-07-04 21:52:52 +0000 | [diff] [blame] | 72 | "develop=" \ |
Matteo Ghidoni | 35de032 | 2020-10-29 13:48:01 +0100 | [diff] [blame] | 73 | "tftp ${load_addr_r} scripts/develop-${arch}.txt && " \ |
| 74 | "env import -t ${load_addr_r} ${filesize} && " \ |
Holger Brunck | e7bec9b | 2011-07-04 21:52:52 +0000 | [diff] [blame] | 75 | "run setup_debug_env\0" \ |
| 76 | "ramfs=" \ |
Matteo Ghidoni | 35de032 | 2020-10-29 13:48:01 +0100 | [diff] [blame] | 77 | "tftp ${load_addr_r} scripts/ramfs-${arch}.txt && " \ |
| 78 | "env import -t ${load_addr_r} ${filesize} && " \ |
Holger Brunck | e7bec9b | 2011-07-04 21:52:52 +0000 | [diff] [blame] | 79 | "run setup_debug_env\0" \ |
Holger Brunck | e7c1fdc | 2011-03-04 14:56:27 +0100 | [diff] [blame] | 80 | "" |
| 81 | |
| 82 | /* |
Holger Brunck | 752ba31 | 2011-03-14 16:01:04 +0100 | [diff] [blame] | 83 | * bootargs |
| 84 | * - modify 'bootargs' |
| 85 | * |
Holger Brunck | 2ff59ee | 2011-07-04 21:27:16 +0000 | [diff] [blame] | 86 | * - 'add_default': default bootargs common for all arm/ppc boards |
Holger Brunck | 752ba31 | 2011-03-14 16:01:04 +0100 | [diff] [blame] | 87 | * - 'addpanic': add kernel panic options |
Holger Brunck | 752ba31 | 2011-03-14 16:01:04 +0100 | [diff] [blame] | 88 | * - 'flashargs': defaults arguments for flash base boot |
| 89 | * |
Holger Brunck | 752ba31 | 2011-03-14 16:01:04 +0100 | [diff] [blame] | 90 | */ |
| 91 | #define CONFIG_KM_DEF_ENV_BOOTARGS \ |
Holger Brunck | 2ff59ee | 2011-07-04 21:27:16 +0000 | [diff] [blame] | 92 | "add_default=" \ |
Holger Brunck | 752ba31 | 2011-03-14 16:01:04 +0100 | [diff] [blame] | 93 | "setenv bootargs ${bootargs} " \ |
| 94 | "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \ |
Valentin Longchamp | 1d39959 | 2013-10-18 11:47:16 +0200 | [diff] [blame] | 95 | ":${hostname}:${netdev}:off:" \ |
Holger Brunck | 2ff59ee | 2011-07-04 21:27:16 +0000 | [diff] [blame] | 96 | " console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}" \ |
Andreas Huber | 28c63c7 | 2011-09-13 23:06:11 +0000 | [diff] [blame] | 97 | " mem=${kernelmem} init=${init}" \ |
Holger Brunck | ffcbb93 | 2013-01-21 03:55:24 +0000 | [diff] [blame] | 98 | CONFIG_KM_ECC_MODE \ |
Marek Vasut | fd5ba89 | 2012-09-23 17:41:23 +0200 | [diff] [blame] | 99 | " phram.phram=phvar,${varaddr}," __stringify(CONFIG_KM_PHRAM)\ |
Andreas Huber | a81548a | 2012-05-04 10:30:16 +0200 | [diff] [blame] | 100 | " " CONFIG_KM_UBI_LINUX_MTD " " \ |
Holger Brunck | 2ff59ee | 2011-07-04 21:27:16 +0000 | [diff] [blame] | 101 | CONFIG_KM_DEF_BOOT_ARGS_CPU \ |
| 102 | "\0" \ |
Holger Brunck | 752ba31 | 2011-03-14 16:01:04 +0100 | [diff] [blame] | 103 | "addpanic=" \ |
Holger Brunck | 0b53902 | 2011-05-04 01:47:34 +0000 | [diff] [blame] | 104 | "setenv bootargs ${bootargs} panic=1 panic_on_oops=1\0" \ |
Holger Brunck | 752ba31 | 2011-03-14 16:01:04 +0100 | [diff] [blame] | 105 | "flashargs=" \ |
| 106 | "setenv bootargs " \ |
Thomas Herzmann | 1d253c1 | 2011-04-08 02:47:41 +0000 | [diff] [blame] | 107 | "root=mtdblock:rootfs${boot_bank} " \ |
Holger Brunck | 752ba31 | 2011-03-14 16:01:04 +0100 | [diff] [blame] | 108 | "rootfstype=squashfs ro\0" \ |
| 109 | "" |
| 110 | |
Holger Brunck | e7c1fdc | 2011-03-04 14:56:27 +0100 | [diff] [blame] | 111 | /* |
Holger Brunck | 752ba31 | 2011-03-14 16:01:04 +0100 | [diff] [blame] | 112 | * flash_boot |
| 113 | * - commands for booting from flash |
| 114 | * |
Holger Brunck | 752ba31 | 2011-03-14 16:01:04 +0100 | [diff] [blame] | 115 | * - 'cramfsloadkernel': copy kernel from a cramfs to ram |
| 116 | * - 'ubiattach': attach ubi partition |
| 117 | * - 'ubicopy': copy ubi volume to ram |
| 118 | * - volume names: bootfs0, bootfs1, bootfs2, ... |
Holger Brunck | 752ba31 | 2011-03-14 16:01:04 +0100 | [diff] [blame] | 119 | * |
| 120 | * processor specific settings |
| 121 | * - 'cramfsloadfdt': copy fdt from a cramfs to ram |
| 122 | */ |
| 123 | #define CONFIG_KM_DEF_ENV_FLASH_BOOT \ |
Marek Vasut | fd5ba89 | 2012-09-23 17:41:23 +0200 | [diff] [blame] | 124 | "cramfsaddr=" __stringify(CONFIG_KM_CRAMFS_ADDR) "\0" \ |
Andreas Huber | c31a757 | 2013-01-21 03:55:20 +0000 | [diff] [blame] | 125 | "cramfsloadkernel=cramfsload ${load_addr_r} ${uimage}\0" \ |
Holger Brunck | 3a0f386 | 2020-10-09 17:21:33 +0200 | [diff] [blame] | 126 | "ubicopy=ubi read ${cramfsaddr} bootfs${boot_bank}\0" \ |
Andreas Huber | c31a757 | 2013-01-21 03:55:20 +0000 | [diff] [blame] | 127 | "uimage=" CONFIG_KM_UIMAGE_NAME \ |
Andreas Huber | a81548a | 2012-05-04 10:30:16 +0200 | [diff] [blame] | 128 | CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI |
Holger Brunck | 752ba31 | 2011-03-14 16:01:04 +0100 | [diff] [blame] | 129 | |
| 130 | /* |
Holger Brunck | 752ba31 | 2011-03-14 16:01:04 +0100 | [diff] [blame] | 131 | * constants |
| 132 | * - KM specific constants and commands |
| 133 | * |
| 134 | * - 'default': setup default environment |
| 135 | */ |
| 136 | #define CONFIG_KM_DEF_ENV_CONSTANTS \ |
Thomas Herzmann | 1d253c1 | 2011-04-08 02:47:41 +0000 | [diff] [blame] | 137 | "backup_bank=0\0" \ |
Holger Brunck | 2ff59ee | 2011-07-04 21:27:16 +0000 | [diff] [blame] | 138 | "release=run newenv; reset\0" \ |
Marek Vasut | fd5ba89 | 2012-09-23 17:41:23 +0200 | [diff] [blame] | 139 | "pnvramsize=" __stringify(CONFIG_KM_PNVRAM) "\0" \ |
Thomas Herzmann | 80d5c9e | 2011-06-05 22:22:13 +0000 | [diff] [blame] | 140 | "testbootcmd=setenv boot_bank ${test_bank}; " \ |
| 141 | "run ${subbootcmds}; reset\0" \ |
Holger Brunck | c7c7169 | 2020-10-09 17:21:32 +0200 | [diff] [blame] | 142 | "env_version=1\0" \ |
Holger Brunck | 752ba31 | 2011-03-14 16:01:04 +0100 | [diff] [blame] | 143 | "" |
| 144 | |
Heiko Schocher | a8d5189 | 2009-03-12 07:37:18 +0100 | [diff] [blame] | 145 | #ifndef CONFIG_KM_DEF_ENV |
| 146 | #define CONFIG_KM_DEF_ENV \ |
Holger Brunck | e7c1fdc | 2011-03-04 14:56:27 +0100 | [diff] [blame] | 147 | CONFIG_KM_DEF_ENV_BOOTPARAMS \ |
Holger Brunck | ac4eb2c | 2019-11-26 19:09:01 +0100 | [diff] [blame] | 148 | "netdev=" __stringify(CONFIG_KM_DEF_NETDEV) "\0" \ |
Holger Brunck | 752ba31 | 2011-03-14 16:01:04 +0100 | [diff] [blame] | 149 | CONFIG_KM_DEF_ENV_CPU \ |
Holger Brunck | e7c1fdc | 2011-03-04 14:56:27 +0100 | [diff] [blame] | 150 | CONFIG_KM_DEF_ENV_BOOTTARGETS \ |
Holger Brunck | 752ba31 | 2011-03-14 16:01:04 +0100 | [diff] [blame] | 151 | CONFIG_KM_DEF_ENV_BOOTARGS \ |
Holger Brunck | 752ba31 | 2011-03-14 16:01:04 +0100 | [diff] [blame] | 152 | CONFIG_KM_DEF_ENV_FLASH_BOOT \ |
Holger Brunck | e7c1fdc | 2011-03-04 14:56:27 +0100 | [diff] [blame] | 153 | CONFIG_KM_DEF_ENV_CONSTANTS \ |
Holger Brunck | 752ba31 | 2011-03-14 16:01:04 +0100 | [diff] [blame] | 154 | "altbootcmd=run bootcmd\0" \ |
Gerlando Falauto | ae2adaf | 2014-01-27 16:58:27 +0100 | [diff] [blame] | 155 | "boot=bootm ${load_addr_r} - ${fdt_addr_r}\0" \ |
Holger Brunck | 2ff59ee | 2011-07-04 21:27:16 +0000 | [diff] [blame] | 156 | "bootcmd=km_checkbidhwk && " \ |
Thomas Herzmann | b2c3160 | 2012-05-04 10:55:58 +0200 | [diff] [blame] | 157 | "setenv bootcmd \'if km_checktestboot; then; " \ |
| 158 | "setenv boot_bank ${test_bank}; else; " \ |
| 159 | "setenv boot_bank ${actual_bank}; fi;" \ |
Holger Brunck | 2ff59ee | 2011-07-04 21:27:16 +0000 | [diff] [blame] | 160 | "run ${subbootcmds}; reset\' && " \ |
| 161 | "setenv altbootcmd \'setenv boot_bank ${backup_bank}; " \ |
| 162 | "run ${subbootcmds}; reset\' && " \ |
| 163 | "saveenv && saveenv && boot\0" \ |
Gerlando Falauto | ae2adaf | 2014-01-27 16:58:27 +0100 | [diff] [blame] | 164 | "cramfsloadfdt=" \ |
| 165 | "cramfsload ${fdt_addr_r} " \ |
| 166 | "fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb\0" \ |
Holger Brunck | ff41a75 | 2020-10-30 12:45:49 +0100 | [diff] [blame] | 167 | "fdt_addr_r=" __stringify(CONFIG_KM_FDT_ADDR) "\0" \ |
Holger Brunck | 752ba31 | 2011-03-14 16:01:04 +0100 | [diff] [blame] | 168 | "init=/sbin/init-overlay.sh\0" \ |
Holger Brunck | ff41a75 | 2020-10-30 12:45:49 +0100 | [diff] [blame] | 169 | "load_addr_r=" __stringify(CONFIG_KM_KERNEL_ADDR) "\0" \ |
Holger Brunck | 2ff59ee | 2011-07-04 21:27:16 +0000 | [diff] [blame] | 170 | "load=tftpboot ${load_addr_r} ${u-boot}\0" \ |
Heiko Schocher | a8d5189 | 2009-03-12 07:37:18 +0100 | [diff] [blame] | 171 | "" |
| 172 | #endif /* CONFIG_KM_DEF_ENV */ |
| 173 | |
Heiko Schocher | 7937e4f | 2008-11-20 09:59:09 +0100 | [diff] [blame] | 174 | #endif /* __CONFIG_KEYMILE_H */ |