blob: 8433d8e5682df1b461e9ea8ea2f372f5be10e074 [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
Heiko Schocher7937e4f2008-11-20 09:59:09 +010010/*
11 * Miscellaneous configurable options
12 */
Heiko Schocher7937e4f2008-11-20 09:59:09 +010013#if defined(CONFIG_CMD_KGDB)
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010014#define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
Heiko Schocher7937e4f2008-11-20 09:59:09 +010015#else
Holger Brunck0bd82022011-03-14 15:49:05 +010016#define CONFIG_SYS_CBSIZE 512 /* Console I/O Buffer Size */
Heiko Schocher7937e4f2008-11-20 09:59:09 +010017#endif
Holger Brunck0bd82022011-03-14 15:49:05 +010018#define CONFIG_SYS_MAXARGS 32 /* max number of command args */
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010019#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
Heiko Schocher7937e4f2008-11-20 09:59:09 +010020
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010021#define CONFIG_HUSH_INIT_VAR
Heiko Schocher7937e4f2008-11-20 09:59:09 +010022
Holger Brunck4559d1f2011-04-08 02:47:46 +000023#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 }
Heiko Schocher7937e4f2008-11-20 09:59:09 +010024
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010025#define CONFIG_LOADS_ECHO
26#define CONFIG_SYS_LOADS_BAUD_CHANGE
Heiko Schocher7937e4f2008-11-20 09:59:09 +010027
Heiko Schocher7937e4f2008-11-20 09:59:09 +010028/*
29 * BOOTP options
30 */
31#define CONFIG_BOOTP_BOOTFILESIZE
Heiko Schocher7937e4f2008-11-20 09:59:09 +010032
Heiko Schocher875f47282009-07-09 12:04:18 +020033/* UBI Support for all Keymile boards */
Heiko Schocher875f47282009-07-09 12:04:18 +020034#define CONFIG_MTD_CONCAT
35
Holger Bruncke7c1fdc2011-03-04 14:56:27 +010036#ifndef CONFIG_KM_DEF_ENV_BOOTPARAMS
37#define CONFIG_KM_DEF_ENV_BOOTPARAMS \
Holger Brunck2ff59ee2011-07-04 21:27:16 +000038 "actual_bank=0\0"
Heiko Schochera8d51892009-03-12 07:37:18 +010039#endif
40
Holger Brunck752ba312011-03-14 16:01:04 +010041#ifndef CONFIG_KM_DEF_NETDEV
42#define CONFIG_KM_DEF_NETDEV \
43 "netdev=eth0\0"
44#endif
45
Andreas Hubera81548a2012-05-04 10:30:16 +020046#ifndef CONFIG_KM_UBI_PARTITION_NAME_BOOT
47#define CONFIG_KM_UBI_PARTITION_NAME_BOOT "ubi0"
48#endif /* CONFIG_KM_UBI_PARTITION_NAME_BOOT */
49
Valentin Longchampe6d848f2014-01-27 11:49:10 +010050#ifndef CONFIG_KM_UBI_PART_BOOT_OPTS
51#define CONFIG_KM_UBI_PART_BOOT_OPTS ""
52#endif /* CONFIG_KM_UBI_PART_BOOT_OPTS */
53
Andreas Hubera81548a2012-05-04 10:30:16 +020054#ifndef CONFIG_KM_UBI_PARTITION_NAME_APP
55/* one flash chip only called boot */
56/* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
57# define CONFIG_KM_UBI_LINUX_MTD \
Valentin Longchampe6d848f2014-01-27 11:49:10 +010058 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT \
59 CONFIG_KM_UBI_PART_BOOT_OPTS
Andreas Hubera81548a2012-05-04 10:30:16 +020060# define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI \
61 "ubiattach=ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "\0"
62#else /* CONFIG_KM_UBI_PARTITION_NAME_APP */
63/* two flash chips called boot and app */
64/* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
65/* app: CONFIG_KM_UBI_PARTITION_NAME_APP */
66# define CONFIG_KM_UBI_LINUX_MTD \
Valentin Longchampe6d848f2014-01-27 11:49:10 +010067 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT \
68 CONFIG_KM_UBI_PART_BOOT_OPTS " " \
Andreas Hubera81548a2012-05-04 10:30:16 +020069 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_APP
70# define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI \
71 "ubiattach=if test ${boot_bank} -eq 0; then; " \
72 "ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "; else; " \
73 "ubi part " CONFIG_KM_UBI_PARTITION_NAME_APP "; fi\0"
74#endif /* CONFIG_KM_UBI_PARTITION_NAME_APP */
Holger Brunck752ba312011-03-14 16:01:04 +010075
Andreas Huberc31a7572013-01-21 03:55:20 +000076#ifdef CONFIG_NAND_ECC_BCH
77#define CONFIG_KM_UIMAGE_NAME "ecc_bch_uImage\0"
Holger Brunckffcbb932013-01-21 03:55:24 +000078#define CONFIG_KM_ECC_MODE " eccmode=bch"
Andreas Huberc31a7572013-01-21 03:55:20 +000079#else
80#define CONFIG_KM_UIMAGE_NAME "uImage\0"
Holger Brunckffcbb932013-01-21 03:55:24 +000081#define CONFIG_KM_ECC_MODE
Andreas Huberc31a7572013-01-21 03:55:20 +000082#endif
83
Holger Brunck752ba312011-03-14 16:01:04 +010084/*
Holger Bruncke7c1fdc2011-03-04 14:56:27 +010085 * boottargets
Holger Brunck2ff59ee2011-07-04 21:27:16 +000086 * - set 'subbootcmds'
Holger Bruncke7c1fdc2011-03-04 14:56:27 +010087 * - set 'bootcmd' and 'altbootcmd'
88 * available targets:
89 * - 'release': for a standalone system kernel/rootfs from flash
Holger Bruncke7c1fdc2011-03-04 14:56:27 +010090 */
91#define CONFIG_KM_DEF_ENV_BOOTTARGETS \
Valentin Longchamp15e79cc2015-11-13 16:15:20 +010092 "subbootcmds=ubiattach ubicopy checkfdt cramfsloadfdt " \
93 "set_fdthigh cramfsloadkernel flashargs add_default " \
94 "addpanic boot\0" \
Holger Bruncke7bec9b2011-07-04 21:52:52 +000095 "develop=" \
96 "tftp 200000 scripts/develop-${arch}.txt && " \
97 "env import -t 200000 ${filesize} && " \
98 "run setup_debug_env\0" \
99 "ramfs=" \
100 "tftp 200000 scripts/ramfs-${arch}.txt && " \
Holger Brunck0b539022011-05-04 01:47:34 +0000101 "env import -t 200000 ${filesize} && " \
Holger Bruncke7bec9b2011-07-04 21:52:52 +0000102 "run setup_debug_env\0" \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100103 ""
104
105/*
Holger Brunck752ba312011-03-14 16:01:04 +0100106 * bootargs
107 * - modify 'bootargs'
108 *
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000109 * - 'add_default': default bootargs common for all arm/ppc boards
Holger Brunck752ba312011-03-14 16:01:04 +0100110 * - 'addpanic': add kernel panic options
Holger Brunck752ba312011-03-14 16:01:04 +0100111 * - 'flashargs': defaults arguments for flash base boot
112 *
Holger Brunck752ba312011-03-14 16:01:04 +0100113 */
114#define CONFIG_KM_DEF_ENV_BOOTARGS \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000115 "add_default=" \
Holger Brunck752ba312011-03-14 16:01:04 +0100116 "setenv bootargs ${bootargs} " \
117 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
Valentin Longchamp1d399592013-10-18 11:47:16 +0200118 ":${hostname}:${netdev}:off:" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000119 " console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}" \
Andreas Huber28c63c72011-09-13 23:06:11 +0000120 " mem=${kernelmem} init=${init}" \
Holger Brunckffcbb932013-01-21 03:55:24 +0000121 CONFIG_KM_ECC_MODE \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200122 " phram.phram=phvar,${varaddr}," __stringify(CONFIG_KM_PHRAM)\
Andreas Hubera81548a2012-05-04 10:30:16 +0200123 " " CONFIG_KM_UBI_LINUX_MTD " " \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000124 CONFIG_KM_DEF_BOOT_ARGS_CPU \
125 "\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100126 "addpanic=" \
Holger Brunck0b539022011-05-04 01:47:34 +0000127 "setenv bootargs ${bootargs} panic=1 panic_on_oops=1\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100128 "flashargs=" \
129 "setenv bootargs " \
Thomas Herzmann1d253c12011-04-08 02:47:41 +0000130 "root=mtdblock:rootfs${boot_bank} " \
Holger Brunck752ba312011-03-14 16:01:04 +0100131 "rootfstype=squashfs ro\0" \
132 ""
133
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100134/*
Holger Brunck752ba312011-03-14 16:01:04 +0100135 * flash_boot
136 * - commands for booting from flash
137 *
Holger Brunck752ba312011-03-14 16:01:04 +0100138 * - 'cramfsloadkernel': copy kernel from a cramfs to ram
139 * - 'ubiattach': attach ubi partition
140 * - 'ubicopy': copy ubi volume to ram
141 * - volume names: bootfs0, bootfs1, bootfs2, ...
Holger Brunck752ba312011-03-14 16:01:04 +0100142 *
143 * processor specific settings
144 * - 'cramfsloadfdt': copy fdt from a cramfs to ram
145 */
146#define CONFIG_KM_DEF_ENV_FLASH_BOOT \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200147 "cramfsaddr=" __stringify(CONFIG_KM_CRAMFS_ADDR) "\0" \
Andreas Huberc31a7572013-01-21 03:55:20 +0000148 "cramfsloadkernel=cramfsload ${load_addr_r} ${uimage}\0" \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200149 "ubicopy=ubi read "__stringify(CONFIG_KM_CRAMFS_ADDR) \
Holger Brunck0b539022011-05-04 01:47:34 +0000150 " bootfs${boot_bank}\0" \
Andreas Huberc31a7572013-01-21 03:55:20 +0000151 "uimage=" CONFIG_KM_UIMAGE_NAME \
Andreas Hubera81548a2012-05-04 10:30:16 +0200152 CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI
Holger Brunck752ba312011-03-14 16:01:04 +0100153
154/*
Holger Brunck752ba312011-03-14 16:01:04 +0100155 * constants
156 * - KM specific constants and commands
157 *
158 * - 'default': setup default environment
159 */
160#define CONFIG_KM_DEF_ENV_CONSTANTS \
Thomas Herzmann1d253c12011-04-08 02:47:41 +0000161 "backup_bank=0\0" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000162 "release=run newenv; reset\0" \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200163 "pnvramsize=" __stringify(CONFIG_KM_PNVRAM) "\0" \
Thomas Herzmann80d5c9e2011-06-05 22:22:13 +0000164 "testbootcmd=setenv boot_bank ${test_bank}; " \
165 "run ${subbootcmds}; reset\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100166 ""
167
Heiko Schochera8d51892009-03-12 07:37:18 +0100168#ifndef CONFIG_KM_DEF_ENV
169#define CONFIG_KM_DEF_ENV \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100170 CONFIG_KM_DEF_ENV_BOOTPARAMS \
Holger Brunck752ba312011-03-14 16:01:04 +0100171 CONFIG_KM_DEF_NETDEV \
172 CONFIG_KM_DEF_ENV_CPU \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100173 CONFIG_KM_DEF_ENV_BOOTTARGETS \
Holger Brunck752ba312011-03-14 16:01:04 +0100174 CONFIG_KM_DEF_ENV_BOOTARGS \
Holger Brunck752ba312011-03-14 16:01:04 +0100175 CONFIG_KM_DEF_ENV_FLASH_BOOT \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100176 CONFIG_KM_DEF_ENV_CONSTANTS \
Holger Brunck752ba312011-03-14 16:01:04 +0100177 "altbootcmd=run bootcmd\0" \
Gerlando Falautoae2adaf2014-01-27 16:58:27 +0100178 "boot=bootm ${load_addr_r} - ${fdt_addr_r}\0" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000179 "bootcmd=km_checkbidhwk && " \
Thomas Herzmannb2c31602012-05-04 10:55:58 +0200180 "setenv bootcmd \'if km_checktestboot; then; " \
181 "setenv boot_bank ${test_bank}; else; " \
182 "setenv boot_bank ${actual_bank}; fi;" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000183 "run ${subbootcmds}; reset\' && " \
184 "setenv altbootcmd \'setenv boot_bank ${backup_bank}; " \
185 "run ${subbootcmds}; reset\' && " \
186 "saveenv && saveenv && boot\0" \
Gerlando Falautoae2adaf2014-01-27 16:58:27 +0100187 "cramfsloadfdt=" \
188 "cramfsload ${fdt_addr_r} " \
189 "fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb\0" \
190 "fdt_addr_r="__stringify(CONFIG_KM_FDT_ADDR) "\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100191 "init=/sbin/init-overlay.sh\0" \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200192 "load_addr_r="__stringify(CONFIG_KM_KERNEL_ADDR) "\0" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000193 "load=tftpboot ${load_addr_r} ${u-boot}\0" \
Tom Rini5ad8e112017-10-22 17:55:07 -0400194 "mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \
195 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
Heiko Schochera8d51892009-03-12 07:37:18 +0100196 ""
197#endif /* CONFIG_KM_DEF_ENV */
198
Heiko Schocher7937e4f2008-11-20 09:59:09 +0100199#endif /* __CONFIG_KEYMILE_H */