blob: 1bfc89bf44ca9f4b8c61c39e67901e04bf3ef6a7 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Heiko Schocher7937e4f2008-11-20 09:59:09 +01002/*
Heiko Schocher8ce3dd52011-03-15 16:52:29 +01003 * (C) Copyright 2008-2011
Heiko Schocher7937e4f2008-11-20 09:59:09 +01004 * Heiko Schocher, DENX Software Engineering, hs@denx.de.
Heiko Schocher7937e4f2008-11-20 09:59:09 +01005 */
6
7#ifndef __CONFIG_KEYMILE_H
8#define __CONFIG_KEYMILE_H
9
Simon Glassfb64e362020-05-10 11:40:09 -060010#include <linux/stringify.h>
11
Heiko Schocher7937e4f2008-11-20 09:59:09 +010012/*
13 * Miscellaneous configurable options
14 */
Heiko Schocher7937e4f2008-11-20 09:59:09 +010015
Holger Brunck4559d1f2011-04-08 02:47:46 +000016#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 }
Heiko Schocher7937e4f2008-11-20 09:59:09 +010017
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010018#define CONFIG_LOADS_ECHO
19#define CONFIG_SYS_LOADS_BAUD_CHANGE
Heiko Schocher7937e4f2008-11-20 09:59:09 +010020
Holger Bruncke7c1fdc2011-03-04 14:56:27 +010021#ifndef CONFIG_KM_DEF_ENV_BOOTPARAMS
22#define CONFIG_KM_DEF_ENV_BOOTPARAMS \
Holger Brunck2ff59ee2011-07-04 21:27:16 +000023 "actual_bank=0\0"
Heiko Schochera8d51892009-03-12 07:37:18 +010024#endif
25
Andreas Hubera81548a2012-05-04 10:30:16 +020026#ifndef CONFIG_KM_UBI_PARTITION_NAME_BOOT
27#define CONFIG_KM_UBI_PARTITION_NAME_BOOT "ubi0"
28#endif /* CONFIG_KM_UBI_PARTITION_NAME_BOOT */
29
Valentin Longchampe6d848f2014-01-27 11:49:10 +010030#ifndef CONFIG_KM_UBI_PART_BOOT_OPTS
31#define CONFIG_KM_UBI_PART_BOOT_OPTS ""
32#endif /* CONFIG_KM_UBI_PART_BOOT_OPTS */
33
Andreas Hubera81548a2012-05-04 10:30:16 +020034#ifndef CONFIG_KM_UBI_PARTITION_NAME_APP
35/* one flash chip only called boot */
36/* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
37# define CONFIG_KM_UBI_LINUX_MTD \
Valentin Longchampe6d848f2014-01-27 11:49:10 +010038 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT \
39 CONFIG_KM_UBI_PART_BOOT_OPTS
Andreas Hubera81548a2012-05-04 10:30:16 +020040# define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI \
41 "ubiattach=ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "\0"
42#else /* CONFIG_KM_UBI_PARTITION_NAME_APP */
43/* two flash chips called boot and app */
44/* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
45/* app: CONFIG_KM_UBI_PARTITION_NAME_APP */
46# define CONFIG_KM_UBI_LINUX_MTD \
Valentin Longchampe6d848f2014-01-27 11:49:10 +010047 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT \
48 CONFIG_KM_UBI_PART_BOOT_OPTS " " \
Andreas Hubera81548a2012-05-04 10:30:16 +020049 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_APP
50# define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI \
51 "ubiattach=if test ${boot_bank} -eq 0; then; " \
52 "ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "; else; " \
53 "ubi part " CONFIG_KM_UBI_PARTITION_NAME_APP "; fi\0"
54#endif /* CONFIG_KM_UBI_PARTITION_NAME_APP */
Holger Brunck752ba312011-03-14 16:01:04 +010055
Andreas Huberc31a7572013-01-21 03:55:20 +000056#ifdef CONFIG_NAND_ECC_BCH
57#define CONFIG_KM_UIMAGE_NAME "ecc_bch_uImage\0"
Holger Brunckffcbb932013-01-21 03:55:24 +000058#define CONFIG_KM_ECC_MODE " eccmode=bch"
Andreas Huberc31a7572013-01-21 03:55:20 +000059#else
60#define CONFIG_KM_UIMAGE_NAME "uImage\0"
Holger Brunckffcbb932013-01-21 03:55:24 +000061#define CONFIG_KM_ECC_MODE
Andreas Huberc31a7572013-01-21 03:55:20 +000062#endif
63
Holger Brunck752ba312011-03-14 16:01:04 +010064/*
Holger Bruncke7c1fdc2011-03-04 14:56:27 +010065 * boottargets
Holger Brunck2ff59ee2011-07-04 21:27:16 +000066 * - set 'subbootcmds'
Holger Bruncke7c1fdc2011-03-04 14:56:27 +010067 * - set 'bootcmd' and 'altbootcmd'
68 * available targets:
69 * - 'release': for a standalone system kernel/rootfs from flash
Holger Bruncke7c1fdc2011-03-04 14:56:27 +010070 */
71#define CONFIG_KM_DEF_ENV_BOOTTARGETS \
Valentin Longchamp15e79cc2015-11-13 16:15:20 +010072 "subbootcmds=ubiattach ubicopy checkfdt cramfsloadfdt " \
73 "set_fdthigh cramfsloadkernel flashargs add_default " \
74 "addpanic boot\0" \
Holger Bruncke7bec9b2011-07-04 21:52:52 +000075 "develop=" \
Matteo Ghidoni35de0322020-10-29 13:48:01 +010076 "tftp ${load_addr_r} scripts/develop-${arch}.txt && " \
77 "env import -t ${load_addr_r} ${filesize} && " \
Holger Bruncke7bec9b2011-07-04 21:52:52 +000078 "run setup_debug_env\0" \
79 "ramfs=" \
Matteo Ghidoni35de0322020-10-29 13:48:01 +010080 "tftp ${load_addr_r} scripts/ramfs-${arch}.txt && " \
81 "env import -t ${load_addr_r} ${filesize} && " \
Holger Bruncke7bec9b2011-07-04 21:52:52 +000082 "run setup_debug_env\0" \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +010083 ""
84
85/*
Holger Brunck752ba312011-03-14 16:01:04 +010086 * bootargs
87 * - modify 'bootargs'
88 *
Holger Brunck2ff59ee2011-07-04 21:27:16 +000089 * - 'add_default': default bootargs common for all arm/ppc boards
Holger Brunck752ba312011-03-14 16:01:04 +010090 * - 'addpanic': add kernel panic options
Holger Brunck752ba312011-03-14 16:01:04 +010091 * - 'flashargs': defaults arguments for flash base boot
92 *
Holger Brunck752ba312011-03-14 16:01:04 +010093 */
94#define CONFIG_KM_DEF_ENV_BOOTARGS \
Holger Brunck2ff59ee2011-07-04 21:27:16 +000095 "add_default=" \
Holger Brunck752ba312011-03-14 16:01:04 +010096 "setenv bootargs ${bootargs} " \
97 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
Valentin Longchamp1d399592013-10-18 11:47:16 +020098 ":${hostname}:${netdev}:off:" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +000099 " console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}" \
Andreas Huber28c63c72011-09-13 23:06:11 +0000100 " mem=${kernelmem} init=${init}" \
Holger Brunckffcbb932013-01-21 03:55:24 +0000101 CONFIG_KM_ECC_MODE \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200102 " phram.phram=phvar,${varaddr}," __stringify(CONFIG_KM_PHRAM)\
Andreas Hubera81548a2012-05-04 10:30:16 +0200103 " " CONFIG_KM_UBI_LINUX_MTD " " \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000104 CONFIG_KM_DEF_BOOT_ARGS_CPU \
105 "\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100106 "addpanic=" \
Holger Brunck0b539022011-05-04 01:47:34 +0000107 "setenv bootargs ${bootargs} panic=1 panic_on_oops=1\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100108 "flashargs=" \
109 "setenv bootargs " \
Thomas Herzmann1d253c12011-04-08 02:47:41 +0000110 "root=mtdblock:rootfs${boot_bank} " \
Holger Brunck752ba312011-03-14 16:01:04 +0100111 "rootfstype=squashfs ro\0" \
112 ""
113
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100114/*
Holger Brunck752ba312011-03-14 16:01:04 +0100115 * flash_boot
116 * - commands for booting from flash
117 *
Holger Brunck752ba312011-03-14 16:01:04 +0100118 * - 'cramfsloadkernel': copy kernel from a cramfs to ram
119 * - 'ubiattach': attach ubi partition
120 * - 'ubicopy': copy ubi volume to ram
121 * - volume names: bootfs0, bootfs1, bootfs2, ...
Holger Brunck752ba312011-03-14 16:01:04 +0100122 *
123 * processor specific settings
124 * - 'cramfsloadfdt': copy fdt from a cramfs to ram
125 */
126#define CONFIG_KM_DEF_ENV_FLASH_BOOT \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200127 "cramfsaddr=" __stringify(CONFIG_KM_CRAMFS_ADDR) "\0" \
Andreas Huberc31a7572013-01-21 03:55:20 +0000128 "cramfsloadkernel=cramfsload ${load_addr_r} ${uimage}\0" \
Holger Brunck3a0f3862020-10-09 17:21:33 +0200129 "ubicopy=ubi read ${cramfsaddr} bootfs${boot_bank}\0" \
Andreas Huberc31a7572013-01-21 03:55:20 +0000130 "uimage=" CONFIG_KM_UIMAGE_NAME \
Andreas Hubera81548a2012-05-04 10:30:16 +0200131 CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI
Holger Brunck752ba312011-03-14 16:01:04 +0100132
133/*
Holger Brunck752ba312011-03-14 16:01:04 +0100134 * constants
135 * - KM specific constants and commands
136 *
137 * - 'default': setup default environment
138 */
139#define CONFIG_KM_DEF_ENV_CONSTANTS \
Thomas Herzmann1d253c12011-04-08 02:47:41 +0000140 "backup_bank=0\0" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000141 "release=run newenv; reset\0" \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200142 "pnvramsize=" __stringify(CONFIG_KM_PNVRAM) "\0" \
Thomas Herzmann80d5c9e2011-06-05 22:22:13 +0000143 "testbootcmd=setenv boot_bank ${test_bank}; " \
144 "run ${subbootcmds}; reset\0" \
Holger Brunckc7c71692020-10-09 17:21:32 +0200145 "env_version=1\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100146 ""
147
Heiko Schochera8d51892009-03-12 07:37:18 +0100148#ifndef CONFIG_KM_DEF_ENV
149#define CONFIG_KM_DEF_ENV \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100150 CONFIG_KM_DEF_ENV_BOOTPARAMS \
Holger Brunckac4eb2c2019-11-26 19:09:01 +0100151 "netdev=" __stringify(CONFIG_KM_DEF_NETDEV) "\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100152 CONFIG_KM_DEF_ENV_CPU \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100153 CONFIG_KM_DEF_ENV_BOOTTARGETS \
Holger Brunck752ba312011-03-14 16:01:04 +0100154 CONFIG_KM_DEF_ENV_BOOTARGS \
Holger Brunck752ba312011-03-14 16:01:04 +0100155 CONFIG_KM_DEF_ENV_FLASH_BOOT \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100156 CONFIG_KM_DEF_ENV_CONSTANTS \
Holger Brunck752ba312011-03-14 16:01:04 +0100157 "altbootcmd=run bootcmd\0" \
Gerlando Falautoae2adaf2014-01-27 16:58:27 +0100158 "boot=bootm ${load_addr_r} - ${fdt_addr_r}\0" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000159 "bootcmd=km_checkbidhwk && " \
Thomas Herzmannb2c31602012-05-04 10:55:58 +0200160 "setenv bootcmd \'if km_checktestboot; then; " \
161 "setenv boot_bank ${test_bank}; else; " \
162 "setenv boot_bank ${actual_bank}; fi;" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000163 "run ${subbootcmds}; reset\' && " \
164 "setenv altbootcmd \'setenv boot_bank ${backup_bank}; " \
165 "run ${subbootcmds}; reset\' && " \
166 "saveenv && saveenv && boot\0" \
Gerlando Falautoae2adaf2014-01-27 16:58:27 +0100167 "cramfsloadfdt=" \
168 "cramfsload ${fdt_addr_r} " \
169 "fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb\0" \
Holger Brunckff41a752020-10-30 12:45:49 +0100170 "fdt_addr_r=" __stringify(CONFIG_KM_FDT_ADDR) "\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100171 "init=/sbin/init-overlay.sh\0" \
Holger Brunckff41a752020-10-30 12:45:49 +0100172 "load_addr_r=" __stringify(CONFIG_KM_KERNEL_ADDR) "\0" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000173 "load=tftpboot ${load_addr_r} ${u-boot}\0" \
Heiko Schochera8d51892009-03-12 07:37:18 +0100174 ""
175#endif /* CONFIG_KM_DEF_ENV */
176
Heiko Schocher7937e4f2008-11-20 09:59:09 +0100177#endif /* __CONFIG_KEYMILE_H */