blob: 35cf27a2eb90541cb628c29d3759e19864d4f465 [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
Holger Bruncke7c1fdc2011-03-04 14:56:27 +010018#ifndef CONFIG_KM_DEF_ENV_BOOTPARAMS
19#define CONFIG_KM_DEF_ENV_BOOTPARAMS \
Holger Brunck2ff59ee2011-07-04 21:27:16 +000020 "actual_bank=0\0"
Heiko Schochera8d51892009-03-12 07:37:18 +010021#endif
22
Andreas Hubera81548a2012-05-04 10:30:16 +020023#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 Longchampe6d848f2014-01-27 11:49:10 +010027#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 Hubera81548a2012-05-04 10:30:16 +020031#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 Longchampe6d848f2014-01-27 11:49:10 +010035 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT \
36 CONFIG_KM_UBI_PART_BOOT_OPTS
Andreas Hubera81548a2012-05-04 10:30:16 +020037# 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 Longchampe6d848f2014-01-27 11:49:10 +010044 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT \
45 CONFIG_KM_UBI_PART_BOOT_OPTS " " \
Andreas Hubera81548a2012-05-04 10:30:16 +020046 "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 Brunck752ba312011-03-14 16:01:04 +010052
Andreas Huberc31a7572013-01-21 03:55:20 +000053#ifdef CONFIG_NAND_ECC_BCH
54#define CONFIG_KM_UIMAGE_NAME "ecc_bch_uImage\0"
Holger Brunckffcbb932013-01-21 03:55:24 +000055#define CONFIG_KM_ECC_MODE " eccmode=bch"
Andreas Huberc31a7572013-01-21 03:55:20 +000056#else
57#define CONFIG_KM_UIMAGE_NAME "uImage\0"
Holger Brunckffcbb932013-01-21 03:55:24 +000058#define CONFIG_KM_ECC_MODE
Andreas Huberc31a7572013-01-21 03:55:20 +000059#endif
60
Holger Brunck752ba312011-03-14 16:01:04 +010061/*
Holger Bruncke7c1fdc2011-03-04 14:56:27 +010062 * boottargets
Holger Brunck2ff59ee2011-07-04 21:27:16 +000063 * - set 'subbootcmds'
Holger Bruncke7c1fdc2011-03-04 14:56:27 +010064 * - set 'bootcmd' and 'altbootcmd'
65 * available targets:
66 * - 'release': for a standalone system kernel/rootfs from flash
Holger Bruncke7c1fdc2011-03-04 14:56:27 +010067 */
68#define CONFIG_KM_DEF_ENV_BOOTTARGETS \
Valentin Longchamp15e79cc2015-11-13 16:15:20 +010069 "subbootcmds=ubiattach ubicopy checkfdt cramfsloadfdt " \
70 "set_fdthigh cramfsloadkernel flashargs add_default " \
71 "addpanic boot\0" \
Holger Bruncke7bec9b2011-07-04 21:52:52 +000072 "develop=" \
Matteo Ghidoni35de0322020-10-29 13:48:01 +010073 "tftp ${load_addr_r} scripts/develop-${arch}.txt && " \
74 "env import -t ${load_addr_r} ${filesize} && " \
Holger Bruncke7bec9b2011-07-04 21:52:52 +000075 "run setup_debug_env\0" \
76 "ramfs=" \
Matteo Ghidoni35de0322020-10-29 13:48:01 +010077 "tftp ${load_addr_r} scripts/ramfs-${arch}.txt && " \
78 "env import -t ${load_addr_r} ${filesize} && " \
Holger Bruncke7bec9b2011-07-04 21:52:52 +000079 "run setup_debug_env\0" \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +010080 ""
81
82/*
Holger Brunck752ba312011-03-14 16:01:04 +010083 * bootargs
84 * - modify 'bootargs'
85 *
Holger Brunck2ff59ee2011-07-04 21:27:16 +000086 * - 'add_default': default bootargs common for all arm/ppc boards
Holger Brunck752ba312011-03-14 16:01:04 +010087 * - 'addpanic': add kernel panic options
Holger Brunck752ba312011-03-14 16:01:04 +010088 * - 'flashargs': defaults arguments for flash base boot
89 *
Holger Brunck752ba312011-03-14 16:01:04 +010090 */
91#define CONFIG_KM_DEF_ENV_BOOTARGS \
Holger Brunck2ff59ee2011-07-04 21:27:16 +000092 "add_default=" \
Holger Brunck752ba312011-03-14 16:01:04 +010093 "setenv bootargs ${bootargs} " \
94 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
Valentin Longchamp1d399592013-10-18 11:47:16 +020095 ":${hostname}:${netdev}:off:" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +000096 " console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}" \
Andreas Huber28c63c72011-09-13 23:06:11 +000097 " mem=${kernelmem} init=${init}" \
Holger Brunckffcbb932013-01-21 03:55:24 +000098 CONFIG_KM_ECC_MODE \
Marek Vasutfd5ba892012-09-23 17:41:23 +020099 " phram.phram=phvar,${varaddr}," __stringify(CONFIG_KM_PHRAM)\
Andreas Hubera81548a2012-05-04 10:30:16 +0200100 " " CONFIG_KM_UBI_LINUX_MTD " " \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000101 CONFIG_KM_DEF_BOOT_ARGS_CPU \
102 "\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100103 "addpanic=" \
Holger Brunck0b539022011-05-04 01:47:34 +0000104 "setenv bootargs ${bootargs} panic=1 panic_on_oops=1\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100105 "flashargs=" \
106 "setenv bootargs " \
Thomas Herzmann1d253c12011-04-08 02:47:41 +0000107 "root=mtdblock:rootfs${boot_bank} " \
Holger Brunck752ba312011-03-14 16:01:04 +0100108 "rootfstype=squashfs ro\0" \
109 ""
110
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100111/*
Holger Brunck752ba312011-03-14 16:01:04 +0100112 * flash_boot
113 * - commands for booting from flash
114 *
Holger Brunck752ba312011-03-14 16:01:04 +0100115 * - '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 Brunck752ba312011-03-14 16:01:04 +0100119 *
120 * processor specific settings
121 * - 'cramfsloadfdt': copy fdt from a cramfs to ram
122 */
123#define CONFIG_KM_DEF_ENV_FLASH_BOOT \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200124 "cramfsaddr=" __stringify(CONFIG_KM_CRAMFS_ADDR) "\0" \
Andreas Huberc31a7572013-01-21 03:55:20 +0000125 "cramfsloadkernel=cramfsload ${load_addr_r} ${uimage}\0" \
Holger Brunck3a0f3862020-10-09 17:21:33 +0200126 "ubicopy=ubi read ${cramfsaddr} bootfs${boot_bank}\0" \
Andreas Huberc31a7572013-01-21 03:55:20 +0000127 "uimage=" CONFIG_KM_UIMAGE_NAME \
Andreas Hubera81548a2012-05-04 10:30:16 +0200128 CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI
Holger Brunck752ba312011-03-14 16:01:04 +0100129
130/*
Holger Brunck752ba312011-03-14 16:01:04 +0100131 * constants
132 * - KM specific constants and commands
133 *
134 * - 'default': setup default environment
135 */
136#define CONFIG_KM_DEF_ENV_CONSTANTS \
Thomas Herzmann1d253c12011-04-08 02:47:41 +0000137 "backup_bank=0\0" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000138 "release=run newenv; reset\0" \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200139 "pnvramsize=" __stringify(CONFIG_KM_PNVRAM) "\0" \
Thomas Herzmann80d5c9e2011-06-05 22:22:13 +0000140 "testbootcmd=setenv boot_bank ${test_bank}; " \
141 "run ${subbootcmds}; reset\0" \
Holger Brunckc7c71692020-10-09 17:21:32 +0200142 "env_version=1\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100143 ""
144
Heiko Schochera8d51892009-03-12 07:37:18 +0100145#ifndef CONFIG_KM_DEF_ENV
146#define CONFIG_KM_DEF_ENV \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100147 CONFIG_KM_DEF_ENV_BOOTPARAMS \
Holger Brunckac4eb2c2019-11-26 19:09:01 +0100148 "netdev=" __stringify(CONFIG_KM_DEF_NETDEV) "\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100149 CONFIG_KM_DEF_ENV_CPU \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100150 CONFIG_KM_DEF_ENV_BOOTTARGETS \
Holger Brunck752ba312011-03-14 16:01:04 +0100151 CONFIG_KM_DEF_ENV_BOOTARGS \
Holger Brunck752ba312011-03-14 16:01:04 +0100152 CONFIG_KM_DEF_ENV_FLASH_BOOT \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100153 CONFIG_KM_DEF_ENV_CONSTANTS \
Holger Brunck752ba312011-03-14 16:01:04 +0100154 "altbootcmd=run bootcmd\0" \
Gerlando Falautoae2adaf2014-01-27 16:58:27 +0100155 "boot=bootm ${load_addr_r} - ${fdt_addr_r}\0" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000156 "bootcmd=km_checkbidhwk && " \
Thomas Herzmannb2c31602012-05-04 10:55:58 +0200157 "setenv bootcmd \'if km_checktestboot; then; " \
158 "setenv boot_bank ${test_bank}; else; " \
159 "setenv boot_bank ${actual_bank}; fi;" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000160 "run ${subbootcmds}; reset\' && " \
161 "setenv altbootcmd \'setenv boot_bank ${backup_bank}; " \
162 "run ${subbootcmds}; reset\' && " \
163 "saveenv && saveenv && boot\0" \
Gerlando Falautoae2adaf2014-01-27 16:58:27 +0100164 "cramfsloadfdt=" \
165 "cramfsload ${fdt_addr_r} " \
166 "fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb\0" \
Holger Brunckff41a752020-10-30 12:45:49 +0100167 "fdt_addr_r=" __stringify(CONFIG_KM_FDT_ADDR) "\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100168 "init=/sbin/init-overlay.sh\0" \
Holger Brunckff41a752020-10-30 12:45:49 +0100169 "load_addr_r=" __stringify(CONFIG_KM_KERNEL_ADDR) "\0" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000170 "load=tftpboot ${load_addr_r} ${u-boot}\0" \
Heiko Schochera8d51892009-03-12 07:37:18 +0100171 ""
172#endif /* CONFIG_KM_DEF_ENV */
173
Heiko Schocher7937e4f2008-11-20 09:59:09 +0100174#endif /* __CONFIG_KEYMILE_H */