blob: 1971ba4f7e033d7d3242d32d091dbc84e39d0ef1 [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 Schocher8ce3dd52011-03-15 16:52:29 +010013#undef CONFIG_WATCHDOG /* disable platform specific watchdog */
Heiko Schocher7937e4f2008-11-20 09:59:09 +010014
Heiko Schocher7937e4f2008-11-20 09:59:09 +010015/*
16 * Miscellaneous configurable options
17 */
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010018#define CONFIG_SYS_LONGHELP /* undef to save memory */
Heiko Schocher7937e4f2008-11-20 09:59:09 +010019#if defined(CONFIG_CMD_KGDB)
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010020#define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
Heiko Schocher7937e4f2008-11-20 09:59:09 +010021#else
Holger Brunck0bd82022011-03-14 15:49:05 +010022#define CONFIG_SYS_CBSIZE 512 /* Console I/O Buffer Size */
Heiko Schocher7937e4f2008-11-20 09:59:09 +010023#endif
Holger Brunck0bd82022011-03-14 15:49:05 +010024#define CONFIG_SYS_MAXARGS 32 /* max number of command args */
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010025#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
26#define CONFIG_CMDLINE_EDITING
27#define CONFIG_AUTO_COMPLETE
Heiko Schocher7937e4f2008-11-20 09:59:09 +010028
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010029#define CONFIG_HUSH_INIT_VAR
Heiko Schocher7937e4f2008-11-20 09:59:09 +010030
31#define CONFIG_SYS_ALT_MEMTEST /* memory test, takes time */
Heiko Schocher7937e4f2008-11-20 09:59:09 +010032
Holger Brunck4559d1f2011-04-08 02:47:46 +000033#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 }
Heiko Schocher7937e4f2008-11-20 09:59:09 +010034
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010035#define CONFIG_LOADS_ECHO
36#define CONFIG_SYS_LOADS_BAUD_CHANGE
Heiko Schocher7937e4f2008-11-20 09:59:09 +010037
Holger Brunck6c3dd062015-11-13 16:15:19 +010038
Heiko Schochera8d51892009-03-12 07:37:18 +010039/* Support the IVM EEprom */
40#define CONFIG_SYS_IVM_EEPROM_ADR 0x50
41#define CONFIG_SYS_IVM_EEPROM_MAX_LEN 0x400
42#define CONFIG_SYS_IVM_EEPROM_PAGE_LEN 0x100
43
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010044#define CONFIG_SYS_FLASH_PROTECTION
Heiko Schochera8d51892009-03-12 07:37:18 +010045
Heiko Schocher7937e4f2008-11-20 09:59:09 +010046/*
47 * BOOTP options
48 */
49#define CONFIG_BOOTP_BOOTFILESIZE
50#define CONFIG_BOOTP_BOOTPATH
51#define CONFIG_BOOTP_GATEWAY
52#define CONFIG_BOOTP_HOSTNAME
53
Heiko Schocher875f47282009-07-09 12:04:18 +020054/* UBI Support for all Keymile boards */
Heiko Schocher875f47282009-07-09 12:04:18 +020055#define CONFIG_MTD_PARTITIONS
Heiko Schocher875f47282009-07-09 12:04:18 +020056#define CONFIG_MTD_DEVICE
57#define CONFIG_MTD_CONCAT
58
Holger Bruncke7c1fdc2011-03-04 14:56:27 +010059#ifndef CONFIG_KM_DEF_ENV_BOOTPARAMS
60#define CONFIG_KM_DEF_ENV_BOOTPARAMS \
Holger Brunck2ff59ee2011-07-04 21:27:16 +000061 "actual_bank=0\0"
Heiko Schochera8d51892009-03-12 07:37:18 +010062#endif
63
Holger Brunck752ba312011-03-14 16:01:04 +010064#ifndef CONFIG_KM_DEF_NETDEV
65#define CONFIG_KM_DEF_NETDEV \
66 "netdev=eth0\0"
67#endif
68
Andreas Hubera81548a2012-05-04 10:30:16 +020069#ifndef CONFIG_KM_UBI_PARTITION_NAME_BOOT
70#define CONFIG_KM_UBI_PARTITION_NAME_BOOT "ubi0"
71#endif /* CONFIG_KM_UBI_PARTITION_NAME_BOOT */
72
Valentin Longchampe6d848f2014-01-27 11:49:10 +010073#ifndef CONFIG_KM_UBI_PART_BOOT_OPTS
74#define CONFIG_KM_UBI_PART_BOOT_OPTS ""
75#endif /* CONFIG_KM_UBI_PART_BOOT_OPTS */
76
Andreas Hubera81548a2012-05-04 10:30:16 +020077#ifndef CONFIG_KM_UBI_PARTITION_NAME_APP
78/* one flash chip only called boot */
79/* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
80# define CONFIG_KM_UBI_LINUX_MTD \
Valentin Longchampe6d848f2014-01-27 11:49:10 +010081 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT \
82 CONFIG_KM_UBI_PART_BOOT_OPTS
Andreas Hubera81548a2012-05-04 10:30:16 +020083# define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI \
84 "ubiattach=ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "\0"
85#else /* CONFIG_KM_UBI_PARTITION_NAME_APP */
86/* two flash chips called boot and app */
87/* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
88/* app: CONFIG_KM_UBI_PARTITION_NAME_APP */
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 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_APP
93# define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI \
94 "ubiattach=if test ${boot_bank} -eq 0; then; " \
95 "ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "; else; " \
96 "ubi part " CONFIG_KM_UBI_PARTITION_NAME_APP "; fi\0"
97#endif /* CONFIG_KM_UBI_PARTITION_NAME_APP */
Holger Brunck752ba312011-03-14 16:01:04 +010098
Andreas Huberc31a7572013-01-21 03:55:20 +000099#ifdef CONFIG_NAND_ECC_BCH
100#define CONFIG_KM_UIMAGE_NAME "ecc_bch_uImage\0"
Holger Brunckffcbb932013-01-21 03:55:24 +0000101#define CONFIG_KM_ECC_MODE " eccmode=bch"
Andreas Huberc31a7572013-01-21 03:55:20 +0000102#else
103#define CONFIG_KM_UIMAGE_NAME "uImage\0"
Holger Brunckffcbb932013-01-21 03:55:24 +0000104#define CONFIG_KM_ECC_MODE
Andreas Huberc31a7572013-01-21 03:55:20 +0000105#endif
106
Holger Brunck752ba312011-03-14 16:01:04 +0100107/*
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100108 * boottargets
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000109 * - set 'subbootcmds'
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100110 * - set 'bootcmd' and 'altbootcmd'
111 * available targets:
112 * - 'release': for a standalone system kernel/rootfs from flash
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100113 */
114#define CONFIG_KM_DEF_ENV_BOOTTARGETS \
Valentin Longchamp15e79cc2015-11-13 16:15:20 +0100115 "subbootcmds=ubiattach ubicopy checkfdt cramfsloadfdt " \
116 "set_fdthigh cramfsloadkernel flashargs add_default " \
117 "addpanic boot\0" \
Holger Bruncke7bec9b2011-07-04 21:52:52 +0000118 "develop=" \
119 "tftp 200000 scripts/develop-${arch}.txt && " \
120 "env import -t 200000 ${filesize} && " \
121 "run setup_debug_env\0" \
122 "ramfs=" \
123 "tftp 200000 scripts/ramfs-${arch}.txt && " \
Holger Brunck0b539022011-05-04 01:47:34 +0000124 "env import -t 200000 ${filesize} && " \
Holger Bruncke7bec9b2011-07-04 21:52:52 +0000125 "run setup_debug_env\0" \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100126 ""
127
128/*
Holger Brunck752ba312011-03-14 16:01:04 +0100129 * bootargs
130 * - modify 'bootargs'
131 *
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000132 * - 'add_default': default bootargs common for all arm/ppc boards
Holger Brunck752ba312011-03-14 16:01:04 +0100133 * - 'addpanic': add kernel panic options
Holger Brunck752ba312011-03-14 16:01:04 +0100134 * - 'flashargs': defaults arguments for flash base boot
135 *
Holger Brunck752ba312011-03-14 16:01:04 +0100136 */
137#define CONFIG_KM_DEF_ENV_BOOTARGS \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000138 "add_default=" \
Holger Brunck752ba312011-03-14 16:01:04 +0100139 "setenv bootargs ${bootargs} " \
140 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
Valentin Longchamp1d399592013-10-18 11:47:16 +0200141 ":${hostname}:${netdev}:off:" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000142 " console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}" \
Andreas Huber28c63c72011-09-13 23:06:11 +0000143 " mem=${kernelmem} init=${init}" \
Holger Brunckffcbb932013-01-21 03:55:24 +0000144 CONFIG_KM_ECC_MODE \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200145 " phram.phram=phvar,${varaddr}," __stringify(CONFIG_KM_PHRAM)\
Andreas Hubera81548a2012-05-04 10:30:16 +0200146 " " CONFIG_KM_UBI_LINUX_MTD " " \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000147 CONFIG_KM_DEF_BOOT_ARGS_CPU \
148 "\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100149 "addpanic=" \
Holger Brunck0b539022011-05-04 01:47:34 +0000150 "setenv bootargs ${bootargs} panic=1 panic_on_oops=1\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100151 "flashargs=" \
152 "setenv bootargs " \
Thomas Herzmann1d253c12011-04-08 02:47:41 +0000153 "root=mtdblock:rootfs${boot_bank} " \
Holger Brunck752ba312011-03-14 16:01:04 +0100154 "rootfstype=squashfs ro\0" \
155 ""
156
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100157/*
Holger Brunck752ba312011-03-14 16:01:04 +0100158 * flash_boot
159 * - commands for booting from flash
160 *
Holger Brunck752ba312011-03-14 16:01:04 +0100161 * - 'cramfsloadkernel': copy kernel from a cramfs to ram
162 * - 'ubiattach': attach ubi partition
163 * - 'ubicopy': copy ubi volume to ram
164 * - volume names: bootfs0, bootfs1, bootfs2, ...
Holger Brunck752ba312011-03-14 16:01:04 +0100165 *
166 * processor specific settings
167 * - 'cramfsloadfdt': copy fdt from a cramfs to ram
168 */
169#define CONFIG_KM_DEF_ENV_FLASH_BOOT \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200170 "cramfsaddr=" __stringify(CONFIG_KM_CRAMFS_ADDR) "\0" \
Andreas Huberc31a7572013-01-21 03:55:20 +0000171 "cramfsloadkernel=cramfsload ${load_addr_r} ${uimage}\0" \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200172 "ubicopy=ubi read "__stringify(CONFIG_KM_CRAMFS_ADDR) \
Holger Brunck0b539022011-05-04 01:47:34 +0000173 " bootfs${boot_bank}\0" \
Andreas Huberc31a7572013-01-21 03:55:20 +0000174 "uimage=" CONFIG_KM_UIMAGE_NAME \
Andreas Hubera81548a2012-05-04 10:30:16 +0200175 CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI
Holger Brunck752ba312011-03-14 16:01:04 +0100176
177/*
Holger Brunck752ba312011-03-14 16:01:04 +0100178 * constants
179 * - KM specific constants and commands
180 *
181 * - 'default': setup default environment
182 */
183#define CONFIG_KM_DEF_ENV_CONSTANTS \
Thomas Herzmann1d253c12011-04-08 02:47:41 +0000184 "backup_bank=0\0" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000185 "release=run newenv; reset\0" \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200186 "pnvramsize=" __stringify(CONFIG_KM_PNVRAM) "\0" \
Thomas Herzmann80d5c9e2011-06-05 22:22:13 +0000187 "testbootcmd=setenv boot_bank ${test_bank}; " \
188 "run ${subbootcmds}; reset\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100189 ""
190
Heiko Schochera8d51892009-03-12 07:37:18 +0100191#ifndef CONFIG_KM_DEF_ENV
192#define CONFIG_KM_DEF_ENV \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100193 CONFIG_KM_DEF_ENV_BOOTPARAMS \
Holger Brunck752ba312011-03-14 16:01:04 +0100194 CONFIG_KM_DEF_NETDEV \
195 CONFIG_KM_DEF_ENV_CPU \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100196 CONFIG_KM_DEF_ENV_BOOTTARGETS \
Holger Brunck752ba312011-03-14 16:01:04 +0100197 CONFIG_KM_DEF_ENV_BOOTARGS \
Holger Brunck752ba312011-03-14 16:01:04 +0100198 CONFIG_KM_DEF_ENV_FLASH_BOOT \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100199 CONFIG_KM_DEF_ENV_CONSTANTS \
Holger Brunck752ba312011-03-14 16:01:04 +0100200 "altbootcmd=run bootcmd\0" \
Gerlando Falautoae2adaf2014-01-27 16:58:27 +0100201 "boot=bootm ${load_addr_r} - ${fdt_addr_r}\0" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000202 "bootcmd=km_checkbidhwk && " \
Thomas Herzmannb2c31602012-05-04 10:55:58 +0200203 "setenv bootcmd \'if km_checktestboot; then; " \
204 "setenv boot_bank ${test_bank}; else; " \
205 "setenv boot_bank ${actual_bank}; fi;" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000206 "run ${subbootcmds}; reset\' && " \
207 "setenv altbootcmd \'setenv boot_bank ${backup_bank}; " \
208 "run ${subbootcmds}; reset\' && " \
209 "saveenv && saveenv && boot\0" \
Holger Brunckca907c92012-05-04 10:55:54 +0200210 "bootlimit=3\0" \
Gerlando Falautoae2adaf2014-01-27 16:58:27 +0100211 "cramfsloadfdt=" \
212 "cramfsload ${fdt_addr_r} " \
213 "fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb\0" \
214 "fdt_addr_r="__stringify(CONFIG_KM_FDT_ADDR) "\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100215 "init=/sbin/init-overlay.sh\0" \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200216 "load_addr_r="__stringify(CONFIG_KM_KERNEL_ADDR) "\0" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000217 "load=tftpboot ${load_addr_r} ${u-boot}\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100218 "mtdids=" MTDIDS_DEFAULT "\0" \
219 "mtdparts=" MTDPARTS_DEFAULT "\0" \
Heiko Schochera8d51892009-03-12 07:37:18 +0100220 ""
221#endif /* CONFIG_KM_DEF_ENV */
222
Heiko Schocher7937e4f2008-11-20 09:59:09 +0100223#endif /* __CONFIG_KEYMILE_H */