blob: 61890d3621e58553470b5ac89f1d989413bfb6d3 [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 Schocher8ce3dd52011-03-15 16:52:29 +010011#undef CONFIG_WATCHDOG /* disable platform specific watchdog */
Heiko Schocher7937e4f2008-11-20 09:59:09 +010012
Heiko Schocher7937e4f2008-11-20 09:59:09 +010013/*
14 * Miscellaneous configurable options
15 */
Heiko Schocher7937e4f2008-11-20 09:59:09 +010016#if defined(CONFIG_CMD_KGDB)
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010017#define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
Heiko Schocher7937e4f2008-11-20 09:59:09 +010018#else
Holger Brunck0bd82022011-03-14 15:49:05 +010019#define CONFIG_SYS_CBSIZE 512 /* Console I/O Buffer Size */
Heiko Schocher7937e4f2008-11-20 09:59:09 +010020#endif
Holger Brunck0bd82022011-03-14 15:49:05 +010021#define CONFIG_SYS_MAXARGS 32 /* max number of command args */
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010022#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
Heiko Schocher7937e4f2008-11-20 09:59:09 +010023
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010024#define CONFIG_HUSH_INIT_VAR
Heiko Schocher7937e4f2008-11-20 09:59:09 +010025
26#define CONFIG_SYS_ALT_MEMTEST /* memory test, takes time */
Heiko Schocher7937e4f2008-11-20 09:59:09 +010027
Holger Brunck4559d1f2011-04-08 02:47:46 +000028#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 }
Heiko Schocher7937e4f2008-11-20 09:59:09 +010029
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010030#define CONFIG_LOADS_ECHO
31#define CONFIG_SYS_LOADS_BAUD_CHANGE
Heiko Schocher7937e4f2008-11-20 09:59:09 +010032
Holger Brunck6c3dd062015-11-13 16:15:19 +010033
Heiko Schochera8d51892009-03-12 07:37:18 +010034/* Support the IVM EEprom */
35#define CONFIG_SYS_IVM_EEPROM_ADR 0x50
36#define CONFIG_SYS_IVM_EEPROM_MAX_LEN 0x400
37#define CONFIG_SYS_IVM_EEPROM_PAGE_LEN 0x100
38
Heiko Schocher8ce3dd52011-03-15 16:52:29 +010039#define CONFIG_SYS_FLASH_PROTECTION
Heiko Schochera8d51892009-03-12 07:37:18 +010040
Heiko Schocher7937e4f2008-11-20 09:59:09 +010041/*
42 * BOOTP options
43 */
44#define CONFIG_BOOTP_BOOTFILESIZE
Heiko Schocher7937e4f2008-11-20 09:59:09 +010045
Heiko Schocher875f47282009-07-09 12:04:18 +020046/* UBI Support for all Keymile boards */
Heiko Schocher875f47282009-07-09 12:04:18 +020047#define CONFIG_MTD_PARTITIONS
Heiko Schocher875f47282009-07-09 12:04:18 +020048#define CONFIG_MTD_DEVICE
49#define CONFIG_MTD_CONCAT
50
Holger Bruncke7c1fdc2011-03-04 14:56:27 +010051#ifndef CONFIG_KM_DEF_ENV_BOOTPARAMS
52#define CONFIG_KM_DEF_ENV_BOOTPARAMS \
Holger Brunck2ff59ee2011-07-04 21:27:16 +000053 "actual_bank=0\0"
Heiko Schochera8d51892009-03-12 07:37:18 +010054#endif
55
Holger Brunck752ba312011-03-14 16:01:04 +010056#ifndef CONFIG_KM_DEF_NETDEV
57#define CONFIG_KM_DEF_NETDEV \
58 "netdev=eth0\0"
59#endif
60
Andreas Hubera81548a2012-05-04 10:30:16 +020061#ifndef CONFIG_KM_UBI_PARTITION_NAME_BOOT
62#define CONFIG_KM_UBI_PARTITION_NAME_BOOT "ubi0"
63#endif /* CONFIG_KM_UBI_PARTITION_NAME_BOOT */
64
Valentin Longchampe6d848f2014-01-27 11:49:10 +010065#ifndef CONFIG_KM_UBI_PART_BOOT_OPTS
66#define CONFIG_KM_UBI_PART_BOOT_OPTS ""
67#endif /* CONFIG_KM_UBI_PART_BOOT_OPTS */
68
Andreas Hubera81548a2012-05-04 10:30:16 +020069#ifndef CONFIG_KM_UBI_PARTITION_NAME_APP
70/* one flash chip only called boot */
71/* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
72# define CONFIG_KM_UBI_LINUX_MTD \
Valentin Longchampe6d848f2014-01-27 11:49:10 +010073 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT \
74 CONFIG_KM_UBI_PART_BOOT_OPTS
Andreas Hubera81548a2012-05-04 10:30:16 +020075# define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI \
76 "ubiattach=ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "\0"
77#else /* CONFIG_KM_UBI_PARTITION_NAME_APP */
78/* two flash chips called boot and app */
79/* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
80/* app: CONFIG_KM_UBI_PARTITION_NAME_APP */
81# define CONFIG_KM_UBI_LINUX_MTD \
Valentin Longchampe6d848f2014-01-27 11:49:10 +010082 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT \
83 CONFIG_KM_UBI_PART_BOOT_OPTS " " \
Andreas Hubera81548a2012-05-04 10:30:16 +020084 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_APP
85# define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI \
86 "ubiattach=if test ${boot_bank} -eq 0; then; " \
87 "ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "; else; " \
88 "ubi part " CONFIG_KM_UBI_PARTITION_NAME_APP "; fi\0"
89#endif /* CONFIG_KM_UBI_PARTITION_NAME_APP */
Holger Brunck752ba312011-03-14 16:01:04 +010090
Andreas Huberc31a7572013-01-21 03:55:20 +000091#ifdef CONFIG_NAND_ECC_BCH
92#define CONFIG_KM_UIMAGE_NAME "ecc_bch_uImage\0"
Holger Brunckffcbb932013-01-21 03:55:24 +000093#define CONFIG_KM_ECC_MODE " eccmode=bch"
Andreas Huberc31a7572013-01-21 03:55:20 +000094#else
95#define CONFIG_KM_UIMAGE_NAME "uImage\0"
Holger Brunckffcbb932013-01-21 03:55:24 +000096#define CONFIG_KM_ECC_MODE
Andreas Huberc31a7572013-01-21 03:55:20 +000097#endif
98
Holger Brunck752ba312011-03-14 16:01:04 +010099/*
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100100 * boottargets
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000101 * - set 'subbootcmds'
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100102 * - set 'bootcmd' and 'altbootcmd'
103 * available targets:
104 * - 'release': for a standalone system kernel/rootfs from flash
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100105 */
106#define CONFIG_KM_DEF_ENV_BOOTTARGETS \
Valentin Longchamp15e79cc2015-11-13 16:15:20 +0100107 "subbootcmds=ubiattach ubicopy checkfdt cramfsloadfdt " \
108 "set_fdthigh cramfsloadkernel flashargs add_default " \
109 "addpanic boot\0" \
Holger Bruncke7bec9b2011-07-04 21:52:52 +0000110 "develop=" \
111 "tftp 200000 scripts/develop-${arch}.txt && " \
112 "env import -t 200000 ${filesize} && " \
113 "run setup_debug_env\0" \
114 "ramfs=" \
115 "tftp 200000 scripts/ramfs-${arch}.txt && " \
Holger Brunck0b539022011-05-04 01:47:34 +0000116 "env import -t 200000 ${filesize} && " \
Holger Bruncke7bec9b2011-07-04 21:52:52 +0000117 "run setup_debug_env\0" \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100118 ""
119
120/*
Holger Brunck752ba312011-03-14 16:01:04 +0100121 * bootargs
122 * - modify 'bootargs'
123 *
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000124 * - 'add_default': default bootargs common for all arm/ppc boards
Holger Brunck752ba312011-03-14 16:01:04 +0100125 * - 'addpanic': add kernel panic options
Holger Brunck752ba312011-03-14 16:01:04 +0100126 * - 'flashargs': defaults arguments for flash base boot
127 *
Holger Brunck752ba312011-03-14 16:01:04 +0100128 */
129#define CONFIG_KM_DEF_ENV_BOOTARGS \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000130 "add_default=" \
Holger Brunck752ba312011-03-14 16:01:04 +0100131 "setenv bootargs ${bootargs} " \
132 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
Valentin Longchamp1d399592013-10-18 11:47:16 +0200133 ":${hostname}:${netdev}:off:" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000134 " console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}" \
Andreas Huber28c63c72011-09-13 23:06:11 +0000135 " mem=${kernelmem} init=${init}" \
Holger Brunckffcbb932013-01-21 03:55:24 +0000136 CONFIG_KM_ECC_MODE \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200137 " phram.phram=phvar,${varaddr}," __stringify(CONFIG_KM_PHRAM)\
Andreas Hubera81548a2012-05-04 10:30:16 +0200138 " " CONFIG_KM_UBI_LINUX_MTD " " \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000139 CONFIG_KM_DEF_BOOT_ARGS_CPU \
140 "\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100141 "addpanic=" \
Holger Brunck0b539022011-05-04 01:47:34 +0000142 "setenv bootargs ${bootargs} panic=1 panic_on_oops=1\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100143 "flashargs=" \
144 "setenv bootargs " \
Thomas Herzmann1d253c12011-04-08 02:47:41 +0000145 "root=mtdblock:rootfs${boot_bank} " \
Holger Brunck752ba312011-03-14 16:01:04 +0100146 "rootfstype=squashfs ro\0" \
147 ""
148
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100149/*
Holger Brunck752ba312011-03-14 16:01:04 +0100150 * flash_boot
151 * - commands for booting from flash
152 *
Holger Brunck752ba312011-03-14 16:01:04 +0100153 * - 'cramfsloadkernel': copy kernel from a cramfs to ram
154 * - 'ubiattach': attach ubi partition
155 * - 'ubicopy': copy ubi volume to ram
156 * - volume names: bootfs0, bootfs1, bootfs2, ...
Holger Brunck752ba312011-03-14 16:01:04 +0100157 *
158 * processor specific settings
159 * - 'cramfsloadfdt': copy fdt from a cramfs to ram
160 */
161#define CONFIG_KM_DEF_ENV_FLASH_BOOT \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200162 "cramfsaddr=" __stringify(CONFIG_KM_CRAMFS_ADDR) "\0" \
Andreas Huberc31a7572013-01-21 03:55:20 +0000163 "cramfsloadkernel=cramfsload ${load_addr_r} ${uimage}\0" \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200164 "ubicopy=ubi read "__stringify(CONFIG_KM_CRAMFS_ADDR) \
Holger Brunck0b539022011-05-04 01:47:34 +0000165 " bootfs${boot_bank}\0" \
Andreas Huberc31a7572013-01-21 03:55:20 +0000166 "uimage=" CONFIG_KM_UIMAGE_NAME \
Andreas Hubera81548a2012-05-04 10:30:16 +0200167 CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI
Holger Brunck752ba312011-03-14 16:01:04 +0100168
169/*
Holger Brunck752ba312011-03-14 16:01:04 +0100170 * constants
171 * - KM specific constants and commands
172 *
173 * - 'default': setup default environment
174 */
175#define CONFIG_KM_DEF_ENV_CONSTANTS \
Thomas Herzmann1d253c12011-04-08 02:47:41 +0000176 "backup_bank=0\0" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000177 "release=run newenv; reset\0" \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200178 "pnvramsize=" __stringify(CONFIG_KM_PNVRAM) "\0" \
Thomas Herzmann80d5c9e2011-06-05 22:22:13 +0000179 "testbootcmd=setenv boot_bank ${test_bank}; " \
180 "run ${subbootcmds}; reset\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100181 ""
182
Heiko Schochera8d51892009-03-12 07:37:18 +0100183#ifndef CONFIG_KM_DEF_ENV
184#define CONFIG_KM_DEF_ENV \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100185 CONFIG_KM_DEF_ENV_BOOTPARAMS \
Holger Brunck752ba312011-03-14 16:01:04 +0100186 CONFIG_KM_DEF_NETDEV \
187 CONFIG_KM_DEF_ENV_CPU \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100188 CONFIG_KM_DEF_ENV_BOOTTARGETS \
Holger Brunck752ba312011-03-14 16:01:04 +0100189 CONFIG_KM_DEF_ENV_BOOTARGS \
Holger Brunck752ba312011-03-14 16:01:04 +0100190 CONFIG_KM_DEF_ENV_FLASH_BOOT \
Holger Bruncke7c1fdc2011-03-04 14:56:27 +0100191 CONFIG_KM_DEF_ENV_CONSTANTS \
Holger Brunck752ba312011-03-14 16:01:04 +0100192 "altbootcmd=run bootcmd\0" \
Gerlando Falautoae2adaf2014-01-27 16:58:27 +0100193 "boot=bootm ${load_addr_r} - ${fdt_addr_r}\0" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000194 "bootcmd=km_checkbidhwk && " \
Thomas Herzmannb2c31602012-05-04 10:55:58 +0200195 "setenv bootcmd \'if km_checktestboot; then; " \
196 "setenv boot_bank ${test_bank}; else; " \
197 "setenv boot_bank ${actual_bank}; fi;" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000198 "run ${subbootcmds}; reset\' && " \
199 "setenv altbootcmd \'setenv boot_bank ${backup_bank}; " \
200 "run ${subbootcmds}; reset\' && " \
201 "saveenv && saveenv && boot\0" \
Holger Brunckca907c92012-05-04 10:55:54 +0200202 "bootlimit=3\0" \
Gerlando Falautoae2adaf2014-01-27 16:58:27 +0100203 "cramfsloadfdt=" \
204 "cramfsload ${fdt_addr_r} " \
205 "fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb\0" \
206 "fdt_addr_r="__stringify(CONFIG_KM_FDT_ADDR) "\0" \
Holger Brunck752ba312011-03-14 16:01:04 +0100207 "init=/sbin/init-overlay.sh\0" \
Marek Vasutfd5ba892012-09-23 17:41:23 +0200208 "load_addr_r="__stringify(CONFIG_KM_KERNEL_ADDR) "\0" \
Holger Brunck2ff59ee2011-07-04 21:27:16 +0000209 "load=tftpboot ${load_addr_r} ${u-boot}\0" \
Tom Rini5ad8e112017-10-22 17:55:07 -0400210 "mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \
211 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
Heiko Schochera8d51892009-03-12 07:37:18 +0100212 ""
213#endif /* CONFIG_KM_DEF_ENV */
214
Heiko Schocher7937e4f2008-11-20 09:59:09 +0100215#endif /* __CONFIG_KEYMILE_H */