blob: c2b38d8af649c1c60dc87f364af066c57d6051b3 [file] [log] [blame]
Heiko Schocher7937e4f2008-11-20 09:59:09 +01001/*
Heiko Schocher8ce3dd52011-03-15 16:52:29 +01002 * (C) Copyright 2008-2011
Heiko Schocher7937e4f2008-11-20 09:59:09 +01003 * Heiko Schocher, DENX Software Engineering, hs@denx.de.
4 *
Wolfgang Denkbd8ec7e2013-10-07 13:07:26 +02005 * SPDX-License-Identifier: GPL-2.0+
Heiko Schocher7937e4f2008-11-20 09:59:09 +01006 */
7
8#ifndef __CONFIG_KEYMILE_H
9#define __CONFIG_KEYMILE_H
10
Heiko Schochercfc58042010-04-26 13:07:28 +020011#define CONFIG_BOOTCOUNT_LIMIT
Heiko Schocher7937e4f2008-11-20 09:59:09 +010012
Heiko Schocher7937e4f2008-11-20 09:59:09 +010013/*
14 * Command line configuration.
15 */
Heiko Schocher875f47282009-07-09 12:04:18 +020016#define CONFIG_CMD_MTDPARTS
Heiko Schocher7937e4f2008-11-20 09:59:09 +010017
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010018#undef CONFIG_WATCHDOG /* disable platform specific watchdog */
Heiko Schocher7937e4f2008-11-20 09:59:09 +010019
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010020#undef CONFIG_BOOTARGS /* the boot command will set bootargs */
Heiko Schocher7937e4f2008-11-20 09:59:09 +010021
22/*
23 * Miscellaneous configurable options
24 */
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010025#define CONFIG_SYS_LONGHELP /* undef to save memory */
Heiko Schocher7937e4f2008-11-20 09:59:09 +010026#if defined(CONFIG_CMD_KGDB)
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010027#define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
Heiko Schocher7937e4f2008-11-20 09:59:09 +010028#else
Holger Brunck0bd82022011-03-14 15:49:05 +010029#define CONFIG_SYS_CBSIZE 512 /* Console I/O Buffer Size */
Heiko Schocher7937e4f2008-11-20 09:59:09 +010030#endif
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010031#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
Holger Brunck0bd82022011-03-14 15:49:05 +010032#define CONFIG_SYS_MAXARGS 32 /* max number of command args */
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010033#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
34#define CONFIG_CMDLINE_EDITING
35#define CONFIG_AUTO_COMPLETE
Heiko Schocher7937e4f2008-11-20 09:59:09 +010036
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010037#define CONFIG_HUSH_INIT_VAR
Heiko Schocher7937e4f2008-11-20 09:59:09 +010038
39#define CONFIG_SYS_ALT_MEMTEST /* memory test, takes time */
Heiko Schocher7937e4f2008-11-20 09:59:09 +010040
Holger Brunck4559d1f2011-04-08 02:47:46 +000041#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 }
Heiko Schocher7937e4f2008-11-20 09:59:09 +010042
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010043#define CONFIG_LOADS_ECHO
44#define CONFIG_SYS_LOADS_BAUD_CHANGE
Heiko Schocher7937e4f2008-11-20 09:59:09 +010045
Holger Brunck6c3dd062015-11-13 16:15:19 +010046
Heiko Schochera8d51892009-03-12 07:37:18 +010047/* Support the IVM EEprom */
48#define CONFIG_SYS_IVM_EEPROM_ADR 0x50
49#define CONFIG_SYS_IVM_EEPROM_MAX_LEN 0x400
50#define CONFIG_SYS_IVM_EEPROM_PAGE_LEN 0x100
51
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010052#define CONFIG_SYS_FLASH_PROTECTION
Heiko Schochera8d51892009-03-12 07:37:18 +010053
Heiko Schocher7937e4f2008-11-20 09:59:09 +010054/*
55 * BOOTP options
56 */
57#define CONFIG_BOOTP_BOOTFILESIZE
58#define CONFIG_BOOTP_BOOTPATH
59#define CONFIG_BOOTP_GATEWAY
60#define CONFIG_BOOTP_HOSTNAME
61
Heiko Schocher875f47282009-07-09 12:04:18 +020062/* UBI Support for all Keymile boards */
Heiko Schocher875f47282009-07-09 12:04:18 +020063#define CONFIG_RBTREE
64#define CONFIG_MTD_PARTITIONS
Heiko Schocher875f47282009-07-09 12:04:18 +020065#define CONFIG_MTD_DEVICE
66#define CONFIG_MTD_CONCAT
67
Holger Bruncke7c1fdc2011-03-04 14:56:27 +010068#ifndef CONFIG_KM_DEF_ENV_BOOTPARAMS
69#define CONFIG_KM_DEF_ENV_BOOTPARAMS \
Holger Brunck2ff59ee2011-07-04 21:27:16 +000070 "actual_bank=0\0"
Heiko Schochera8d51892009-03-12 07:37:18 +010071#endif
72
Holger Brunck752ba312011-03-14 16:01:04 +010073#ifndef CONFIG_KM_DEF_NETDEV
74#define CONFIG_KM_DEF_NETDEV \
75 "netdev=eth0\0"
76#endif
77
Andreas Hubera81548a2012-05-04 10:30:16 +020078#ifndef CONFIG_KM_UBI_PARTITION_NAME_BOOT
79#define CONFIG_KM_UBI_PARTITION_NAME_BOOT "ubi0"
80#endif /* CONFIG_KM_UBI_PARTITION_NAME_BOOT */
81
Valentin Longchampe6d848f2014-01-27 11:49:10 +010082#ifndef CONFIG_KM_UBI_PART_BOOT_OPTS
83#define CONFIG_KM_UBI_PART_BOOT_OPTS ""
84#endif /* CONFIG_KM_UBI_PART_BOOT_OPTS */
85
Andreas Hubera81548a2012-05-04 10:30:16 +020086#ifndef CONFIG_KM_UBI_PARTITION_NAME_APP
87/* one flash chip only called boot */
88/* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
89# define CONFIG_KM_UBI_LINUX_MTD \
Valentin Longchampe6d848f2014-01-27 11:49:10 +010090 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT \
91 CONFIG_KM_UBI_PART_BOOT_OPTS
Andreas Hubera81548a2012-05-04 10:30:16 +020092# define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI \
93 "ubiattach=ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "\0"
94#else /* CONFIG_KM_UBI_PARTITION_NAME_APP */
95/* two flash chips called boot and app */
96/* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
97/* app: CONFIG_KM_UBI_PARTITION_NAME_APP */
98# define CONFIG_KM_UBI_LINUX_MTD \
Valentin Longchampe6d848f2014-01-27 11:49:10 +010099 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT \
100 CONFIG_KM_UBI_PART_BOOT_OPTS " " \
Andreas Hubera81548a2012-05-04 10:30:16 +0200101 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_APP
102# define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI \
103 "ubiattach=if test ${boot_bank} -eq 0; then; " \
104 "ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "; else; " \
105 "ubi part " CONFIG_KM_UBI_PARTITION_NAME_APP "; fi\0"
106#endif /* CONFIG_KM_UBI_PARTITION_NAME_APP */
Holger Brunck752ba312011-03-14 16:01:04 +0100107
Andreas Huberc31a7572013-01-21 03:55:20 +0000108#ifdef CONFIG_NAND_ECC_BCH
109#define CONFIG_KM_UIMAGE_NAME "ecc_bch_uImage\0"
Holger Brunckffcbb932013-01-21 03:55:24 +0000110#define CONFIG_KM_ECC_MODE " eccmode=bch"
Andreas Huberc31a7572013-01-21 03:55:20 +0000111#else
112#define CONFIG_KM_UIMAGE_NAME "uImage\0"
Holger Brunckffcbb932013-01-21 03:55:24 +0000113#define CONFIG_KM_ECC_MODE
Andreas Huberc31a7572013-01-21 03:55:20 +0000114#endif
115
Holger Brunck752ba312011-03-14 16:01:04 +0100116/*
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100117 * boottargets
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000118 * - set 'subbootcmds'
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100119 * - set 'bootcmd' and 'altbootcmd'
120 * available targets:
121 * - 'release': for a standalone system kernel/rootfs from flash
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100122 */
123#define CONFIG_KM_DEF_ENV_BOOTTARGETS \
Valentin Longchamp15e79cc2015-11-13 16:15:20 +0100124 "subbootcmds=ubiattach ubicopy checkfdt cramfsloadfdt " \
125 "set_fdthigh cramfsloadkernel flashargs add_default " \
126 "addpanic boot\0" \
Holger Bruncke7bec9b2011-07-04 21:52:52 +0000127 "develop=" \
128 "tftp 200000 scripts/develop-${arch}.txt && " \
129 "env import -t 200000 ${filesize} && " \
130 "run setup_debug_env\0" \
131 "ramfs=" \
132 "tftp 200000 scripts/ramfs-${arch}.txt && " \
Holger Brunck0b539022011-05-04 01:47:34 +0000133 "env import -t 200000 ${filesize} && " \
Holger Bruncke7bec9b2011-07-04 21:52:52 +0000134 "run setup_debug_env\0" \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100135 ""
136
137/*
Holger Brunck752ba312011-03-14 16:01:04 +0100138 * bootargs
139 * - modify 'bootargs'
140 *
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000141 * - 'add_default': default bootargs common for all arm/ppc boards
Holger Brunck752ba312011-03-14 16:01:04 +0100142 * - 'addpanic': add kernel panic options
Holger Brunck752ba312011-03-14 16:01:04 +0100143 * - 'flashargs': defaults arguments for flash base boot
144 *
Holger Brunck752ba312011-03-14 16:01:04 +0100145 */
146#define CONFIG_KM_DEF_ENV_BOOTARGS \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000147 "add_default=" \
Holger Brunck752ba312011-03-14 16:01:04 +0100148 "setenv bootargs ${bootargs} " \
149 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
Valentin Longchamp1d399592013-10-18 11:47:16 +0200150 ":${hostname}:${netdev}:off:" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000151 " console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}" \
Andreas Huber28c63c72011-09-13 23:06:11 +0000152 " mem=${kernelmem} init=${init}" \
Holger Brunckffcbb932013-01-21 03:55:24 +0000153 CONFIG_KM_ECC_MODE \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200154 " phram.phram=phvar,${varaddr}," __stringify(CONFIG_KM_PHRAM)\
Andreas Hubera81548a2012-05-04 10:30:16 +0200155 " " CONFIG_KM_UBI_LINUX_MTD " " \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000156 CONFIG_KM_DEF_BOOT_ARGS_CPU \
157 "\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100158 "addpanic=" \
Holger Brunck0b539022011-05-04 01:47:34 +0000159 "setenv bootargs ${bootargs} panic=1 panic_on_oops=1\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100160 "flashargs=" \
161 "setenv bootargs " \
Thomas Herzmann1d253c12011-04-08 02:47:41 +0000162 "root=mtdblock:rootfs${boot_bank} " \
Holger Brunck752ba312011-03-14 16:01:04 +0100163 "rootfstype=squashfs ro\0" \
164 ""
165
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100166/*
Holger Brunck752ba312011-03-14 16:01:04 +0100167 * flash_boot
168 * - commands for booting from flash
169 *
Holger Brunck752ba312011-03-14 16:01:04 +0100170 * - 'cramfsloadkernel': copy kernel from a cramfs to ram
171 * - 'ubiattach': attach ubi partition
172 * - 'ubicopy': copy ubi volume to ram
173 * - volume names: bootfs0, bootfs1, bootfs2, ...
Holger Brunck752ba312011-03-14 16:01:04 +0100174 *
175 * processor specific settings
176 * - 'cramfsloadfdt': copy fdt from a cramfs to ram
177 */
178#define CONFIG_KM_DEF_ENV_FLASH_BOOT \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200179 "cramfsaddr=" __stringify(CONFIG_KM_CRAMFS_ADDR) "\0" \
Andreas Huberc31a7572013-01-21 03:55:20 +0000180 "cramfsloadkernel=cramfsload ${load_addr_r} ${uimage}\0" \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200181 "ubicopy=ubi read "__stringify(CONFIG_KM_CRAMFS_ADDR) \
Holger Brunck0b539022011-05-04 01:47:34 +0000182 " bootfs${boot_bank}\0" \
Andreas Huberc31a7572013-01-21 03:55:20 +0000183 "uimage=" CONFIG_KM_UIMAGE_NAME \
Andreas Hubera81548a2012-05-04 10:30:16 +0200184 CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI
Holger Brunck752ba312011-03-14 16:01:04 +0100185
186/*
Holger Brunck752ba312011-03-14 16:01:04 +0100187 * constants
188 * - KM specific constants and commands
189 *
190 * - 'default': setup default environment
191 */
192#define CONFIG_KM_DEF_ENV_CONSTANTS \
Thomas Herzmann1d253c12011-04-08 02:47:41 +0000193 "backup_bank=0\0" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000194 "release=run newenv; reset\0" \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200195 "pnvramsize=" __stringify(CONFIG_KM_PNVRAM) "\0" \
Thomas Herzmann80d5c9e2011-06-05 22:22:13 +0000196 "testbootcmd=setenv boot_bank ${test_bank}; " \
197 "run ${subbootcmds}; reset\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100198 ""
199
Heiko Schochera8d51892009-03-12 07:37:18 +0100200#ifndef CONFIG_KM_DEF_ENV
201#define CONFIG_KM_DEF_ENV \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100202 CONFIG_KM_DEF_ENV_BOOTPARAMS \
Holger Brunck752ba312011-03-14 16:01:04 +0100203 CONFIG_KM_DEF_NETDEV \
204 CONFIG_KM_DEF_ENV_CPU \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100205 CONFIG_KM_DEF_ENV_BOOTTARGETS \
Holger Brunck752ba312011-03-14 16:01:04 +0100206 CONFIG_KM_DEF_ENV_BOOTARGS \
Holger Brunck752ba312011-03-14 16:01:04 +0100207 CONFIG_KM_DEF_ENV_FLASH_BOOT \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100208 CONFIG_KM_DEF_ENV_CONSTANTS \
Holger Brunck752ba312011-03-14 16:01:04 +0100209 "altbootcmd=run bootcmd\0" \
Gerlando Falautoae2adaf2014-01-27 16:58:27 +0100210 "boot=bootm ${load_addr_r} - ${fdt_addr_r}\0" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000211 "bootcmd=km_checkbidhwk && " \
Thomas Herzmannb2c31602012-05-04 10:55:58 +0200212 "setenv bootcmd \'if km_checktestboot; then; " \
213 "setenv boot_bank ${test_bank}; else; " \
214 "setenv boot_bank ${actual_bank}; fi;" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000215 "run ${subbootcmds}; reset\' && " \
216 "setenv altbootcmd \'setenv boot_bank ${backup_bank}; " \
217 "run ${subbootcmds}; reset\' && " \
218 "saveenv && saveenv && boot\0" \
Holger Brunckca907c92012-05-04 10:55:54 +0200219 "bootlimit=3\0" \
Gerlando Falautoae2adaf2014-01-27 16:58:27 +0100220 "cramfsloadfdt=" \
221 "cramfsload ${fdt_addr_r} " \
222 "fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb\0" \
223 "fdt_addr_r="__stringify(CONFIG_KM_FDT_ADDR) "\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100224 "init=/sbin/init-overlay.sh\0" \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200225 "load_addr_r="__stringify(CONFIG_KM_KERNEL_ADDR) "\0" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000226 "load=tftpboot ${load_addr_r} ${u-boot}\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100227 "mtdids=" MTDIDS_DEFAULT "\0" \
228 "mtdparts=" MTDPARTS_DEFAULT "\0" \
Heiko Schochera8d51892009-03-12 07:37:18 +0100229 ""
230#endif /* CONFIG_KM_DEF_ENV */
231
Heiko Schocher7937e4f2008-11-20 09:59:09 +0100232#endif /* __CONFIG_KEYMILE_H */