blob: e0848625181a268cb2e0b44bc7a63d255188e244 [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#if defined(CONFIG_CMD_KGDB)
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010016#define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
Heiko Schocher7937e4f2008-11-20 09:59:09 +010017#else
Holger Brunck0bd82022011-03-14 15:49:05 +010018#define CONFIG_SYS_CBSIZE 512 /* Console I/O Buffer Size */
Heiko Schocher7937e4f2008-11-20 09:59:09 +010019#endif
Holger Brunck0bd82022011-03-14 15:49:05 +010020#define CONFIG_SYS_MAXARGS 32 /* max number of command args */
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010021#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
Heiko Schocher7937e4f2008-11-20 09:59:09 +010022
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010023#define CONFIG_HUSH_INIT_VAR
Heiko Schocher7937e4f2008-11-20 09:59:09 +010024
Holger Brunck4559d1f2011-04-08 02:47:46 +000025#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 }
Heiko Schocher7937e4f2008-11-20 09:59:09 +010026
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010027#define CONFIG_LOADS_ECHO
28#define CONFIG_SYS_LOADS_BAUD_CHANGE
Heiko Schocher7937e4f2008-11-20 09:59:09 +010029
Heiko Schocher7937e4f2008-11-20 09:59:09 +010030/*
31 * BOOTP options
32 */
33#define CONFIG_BOOTP_BOOTFILESIZE
Heiko Schocher7937e4f2008-11-20 09:59:09 +010034
Heiko Schocher875f47282009-07-09 12:04:18 +020035/* UBI Support for all Keymile boards */
Heiko Schocher875f47282009-07-09 12:04:18 +020036#define CONFIG_MTD_CONCAT
37
Holger Bruncke7c1fdc2011-03-04 14:56:27 +010038#ifndef CONFIG_KM_DEF_ENV_BOOTPARAMS
39#define CONFIG_KM_DEF_ENV_BOOTPARAMS \
Holger Brunck2ff59ee2011-07-04 21:27:16 +000040 "actual_bank=0\0"
Heiko Schochera8d51892009-03-12 07:37:18 +010041#endif
42
Andreas Hubera81548a2012-05-04 10:30:16 +020043#ifndef CONFIG_KM_UBI_PARTITION_NAME_BOOT
44#define CONFIG_KM_UBI_PARTITION_NAME_BOOT "ubi0"
45#endif /* CONFIG_KM_UBI_PARTITION_NAME_BOOT */
46
Valentin Longchampe6d848f2014-01-27 11:49:10 +010047#ifndef CONFIG_KM_UBI_PART_BOOT_OPTS
48#define CONFIG_KM_UBI_PART_BOOT_OPTS ""
49#endif /* CONFIG_KM_UBI_PART_BOOT_OPTS */
50
Andreas Hubera81548a2012-05-04 10:30:16 +020051#ifndef CONFIG_KM_UBI_PARTITION_NAME_APP
52/* one flash chip only called boot */
53/* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
54# define CONFIG_KM_UBI_LINUX_MTD \
Valentin Longchampe6d848f2014-01-27 11:49:10 +010055 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT \
56 CONFIG_KM_UBI_PART_BOOT_OPTS
Andreas Hubera81548a2012-05-04 10:30:16 +020057# define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI \
58 "ubiattach=ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "\0"
59#else /* CONFIG_KM_UBI_PARTITION_NAME_APP */
60/* two flash chips called boot and app */
61/* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
62/* app: CONFIG_KM_UBI_PARTITION_NAME_APP */
63# define CONFIG_KM_UBI_LINUX_MTD \
Valentin Longchampe6d848f2014-01-27 11:49:10 +010064 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT \
65 CONFIG_KM_UBI_PART_BOOT_OPTS " " \
Andreas Hubera81548a2012-05-04 10:30:16 +020066 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_APP
67# define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI \
68 "ubiattach=if test ${boot_bank} -eq 0; then; " \
69 "ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "; else; " \
70 "ubi part " CONFIG_KM_UBI_PARTITION_NAME_APP "; fi\0"
71#endif /* CONFIG_KM_UBI_PARTITION_NAME_APP */
Holger Brunck752ba312011-03-14 16:01:04 +010072
Andreas Huberc31a7572013-01-21 03:55:20 +000073#ifdef CONFIG_NAND_ECC_BCH
74#define CONFIG_KM_UIMAGE_NAME "ecc_bch_uImage\0"
Holger Brunckffcbb932013-01-21 03:55:24 +000075#define CONFIG_KM_ECC_MODE " eccmode=bch"
Andreas Huberc31a7572013-01-21 03:55:20 +000076#else
77#define CONFIG_KM_UIMAGE_NAME "uImage\0"
Holger Brunckffcbb932013-01-21 03:55:24 +000078#define CONFIG_KM_ECC_MODE
Andreas Huberc31a7572013-01-21 03:55:20 +000079#endif
80
Holger Brunck752ba312011-03-14 16:01:04 +010081/*
Holger Bruncke7c1fdc2011-03-04 14:56:27 +010082 * boottargets
Holger Brunck2ff59ee2011-07-04 21:27:16 +000083 * - set 'subbootcmds'
Holger Bruncke7c1fdc2011-03-04 14:56:27 +010084 * - set 'bootcmd' and 'altbootcmd'
85 * available targets:
86 * - 'release': for a standalone system kernel/rootfs from flash
Holger Bruncke7c1fdc2011-03-04 14:56:27 +010087 */
88#define CONFIG_KM_DEF_ENV_BOOTTARGETS \
Valentin Longchamp15e79cc2015-11-13 16:15:20 +010089 "subbootcmds=ubiattach ubicopy checkfdt cramfsloadfdt " \
90 "set_fdthigh cramfsloadkernel flashargs add_default " \
91 "addpanic boot\0" \
Holger Bruncke7bec9b2011-07-04 21:52:52 +000092 "develop=" \
Matteo Ghidoni35de0322020-10-29 13:48:01 +010093 "tftp ${load_addr_r} scripts/develop-${arch}.txt && " \
94 "env import -t ${load_addr_r} ${filesize} && " \
Holger Bruncke7bec9b2011-07-04 21:52:52 +000095 "run setup_debug_env\0" \
96 "ramfs=" \
Matteo Ghidoni35de0322020-10-29 13:48:01 +010097 "tftp ${load_addr_r} scripts/ramfs-${arch}.txt && " \
98 "env import -t ${load_addr_r} ${filesize} && " \
Holger Bruncke7bec9b2011-07-04 21:52:52 +000099 "run setup_debug_env\0" \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100100 ""
101
102/*
Holger Brunck752ba312011-03-14 16:01:04 +0100103 * bootargs
104 * - modify 'bootargs'
105 *
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000106 * - 'add_default': default bootargs common for all arm/ppc boards
Holger Brunck752ba312011-03-14 16:01:04 +0100107 * - 'addpanic': add kernel panic options
Holger Brunck752ba312011-03-14 16:01:04 +0100108 * - 'flashargs': defaults arguments for flash base boot
109 *
Holger Brunck752ba312011-03-14 16:01:04 +0100110 */
111#define CONFIG_KM_DEF_ENV_BOOTARGS \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000112 "add_default=" \
Holger Brunck752ba312011-03-14 16:01:04 +0100113 "setenv bootargs ${bootargs} " \
114 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
Valentin Longchamp1d399592013-10-18 11:47:16 +0200115 ":${hostname}:${netdev}:off:" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000116 " console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}" \
Andreas Huber28c63c72011-09-13 23:06:11 +0000117 " mem=${kernelmem} init=${init}" \
Holger Brunckffcbb932013-01-21 03:55:24 +0000118 CONFIG_KM_ECC_MODE \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200119 " phram.phram=phvar,${varaddr}," __stringify(CONFIG_KM_PHRAM)\
Andreas Hubera81548a2012-05-04 10:30:16 +0200120 " " CONFIG_KM_UBI_LINUX_MTD " " \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000121 CONFIG_KM_DEF_BOOT_ARGS_CPU \
122 "\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100123 "addpanic=" \
Holger Brunck0b539022011-05-04 01:47:34 +0000124 "setenv bootargs ${bootargs} panic=1 panic_on_oops=1\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100125 "flashargs=" \
126 "setenv bootargs " \
Thomas Herzmann1d253c12011-04-08 02:47:41 +0000127 "root=mtdblock:rootfs${boot_bank} " \
Holger Brunck752ba312011-03-14 16:01:04 +0100128 "rootfstype=squashfs ro\0" \
129 ""
130
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100131/*
Holger Brunck752ba312011-03-14 16:01:04 +0100132 * flash_boot
133 * - commands for booting from flash
134 *
Holger Brunck752ba312011-03-14 16:01:04 +0100135 * - 'cramfsloadkernel': copy kernel from a cramfs to ram
136 * - 'ubiattach': attach ubi partition
137 * - 'ubicopy': copy ubi volume to ram
138 * - volume names: bootfs0, bootfs1, bootfs2, ...
Holger Brunck752ba312011-03-14 16:01:04 +0100139 *
140 * processor specific settings
141 * - 'cramfsloadfdt': copy fdt from a cramfs to ram
142 */
143#define CONFIG_KM_DEF_ENV_FLASH_BOOT \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200144 "cramfsaddr=" __stringify(CONFIG_KM_CRAMFS_ADDR) "\0" \
Andreas Huberc31a7572013-01-21 03:55:20 +0000145 "cramfsloadkernel=cramfsload ${load_addr_r} ${uimage}\0" \
Holger Brunck3a0f3862020-10-09 17:21:33 +0200146 "ubicopy=ubi read ${cramfsaddr} bootfs${boot_bank}\0" \
Andreas Huberc31a7572013-01-21 03:55:20 +0000147 "uimage=" CONFIG_KM_UIMAGE_NAME \
Andreas Hubera81548a2012-05-04 10:30:16 +0200148 CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI
Holger Brunck752ba312011-03-14 16:01:04 +0100149
150/*
Holger Brunck752ba312011-03-14 16:01:04 +0100151 * constants
152 * - KM specific constants and commands
153 *
154 * - 'default': setup default environment
155 */
156#define CONFIG_KM_DEF_ENV_CONSTANTS \
Thomas Herzmann1d253c12011-04-08 02:47:41 +0000157 "backup_bank=0\0" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000158 "release=run newenv; reset\0" \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200159 "pnvramsize=" __stringify(CONFIG_KM_PNVRAM) "\0" \
Thomas Herzmann80d5c9e2011-06-05 22:22:13 +0000160 "testbootcmd=setenv boot_bank ${test_bank}; " \
161 "run ${subbootcmds}; reset\0" \
Holger Brunckc7c71692020-10-09 17:21:32 +0200162 "env_version=1\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100163 ""
164
Heiko Schochera8d51892009-03-12 07:37:18 +0100165#ifndef CONFIG_KM_DEF_ENV
166#define CONFIG_KM_DEF_ENV \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100167 CONFIG_KM_DEF_ENV_BOOTPARAMS \
Holger Brunckac4eb2c2019-11-26 19:09:01 +0100168 "netdev=" __stringify(CONFIG_KM_DEF_NETDEV) "\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100169 CONFIG_KM_DEF_ENV_CPU \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100170 CONFIG_KM_DEF_ENV_BOOTTARGETS \
Holger Brunck752ba312011-03-14 16:01:04 +0100171 CONFIG_KM_DEF_ENV_BOOTARGS \
Holger Brunck752ba312011-03-14 16:01:04 +0100172 CONFIG_KM_DEF_ENV_FLASH_BOOT \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100173 CONFIG_KM_DEF_ENV_CONSTANTS \
Holger Brunck752ba312011-03-14 16:01:04 +0100174 "altbootcmd=run bootcmd\0" \
Gerlando Falautoae2adaf2014-01-27 16:58:27 +0100175 "boot=bootm ${load_addr_r} - ${fdt_addr_r}\0" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000176 "bootcmd=km_checkbidhwk && " \
Thomas Herzmannb2c31602012-05-04 10:55:58 +0200177 "setenv bootcmd \'if km_checktestboot; then; " \
178 "setenv boot_bank ${test_bank}; else; " \
179 "setenv boot_bank ${actual_bank}; fi;" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000180 "run ${subbootcmds}; reset\' && " \
181 "setenv altbootcmd \'setenv boot_bank ${backup_bank}; " \
182 "run ${subbootcmds}; reset\' && " \
183 "saveenv && saveenv && boot\0" \
Gerlando Falautoae2adaf2014-01-27 16:58:27 +0100184 "cramfsloadfdt=" \
185 "cramfsload ${fdt_addr_r} " \
186 "fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb\0" \
Holger Brunckff41a752020-10-30 12:45:49 +0100187 "fdt_addr_r=" __stringify(CONFIG_KM_FDT_ADDR) "\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100188 "init=/sbin/init-overlay.sh\0" \
Holger Brunckff41a752020-10-30 12:45:49 +0100189 "load_addr_r=" __stringify(CONFIG_KM_KERNEL_ADDR) "\0" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000190 "load=tftpboot ${load_addr_r} ${u-boot}\0" \
Tom Rini5ad8e112017-10-22 17:55:07 -0400191 "mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \
192 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
Heiko Schochera8d51892009-03-12 07:37:18 +0100193 ""
194#endif /* CONFIG_KM_DEF_ENV */
195
Heiko Schocher7937e4f2008-11-20 09:59:09 +0100196#endif /* __CONFIG_KEYMILE_H */