blob: a83782e1cfccebc618e6aa0862b79f8940180f3d [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Heiko Schocher1e8f4e72008-11-20 09:59:09 +01002/*
Heiko Schocherb11f53f2011-03-15 16:52:29 +01003 * (C) Copyright 2008-2011
Heiko Schocher1e8f4e72008-11-20 09:59:09 +01004 * Heiko Schocher, DENX Software Engineering, hs@denx.de.
Heiko Schocher1e8f4e72008-11-20 09:59:09 +01005 */
6
7#ifndef __CONFIG_KEYMILE_H
8#define __CONFIG_KEYMILE_H
9
Heiko Schocherb11f53f2011-03-15 16:52:29 +010010#undef CONFIG_WATCHDOG /* disable platform specific watchdog */
Heiko Schocher1e8f4e72008-11-20 09:59:09 +010011
Heiko Schocher1e8f4e72008-11-20 09:59:09 +010012/*
13 * Miscellaneous configurable options
14 */
Heiko Schocher1e8f4e72008-11-20 09:59:09 +010015#if defined(CONFIG_CMD_KGDB)
Heiko Schocherb11f53f2011-03-15 16:52:29 +010016#define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
Heiko Schocher1e8f4e72008-11-20 09:59:09 +010017#else
Holger Brunckf41ee962011-03-14 15:49:05 +010018#define CONFIG_SYS_CBSIZE 512 /* Console I/O Buffer Size */
Heiko Schocher1e8f4e72008-11-20 09:59:09 +010019#endif
Holger Brunckf41ee962011-03-14 15:49:05 +010020#define CONFIG_SYS_MAXARGS 32 /* max number of command args */
Heiko Schocherb11f53f2011-03-15 16:52:29 +010021#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
Heiko Schocher1e8f4e72008-11-20 09:59:09 +010022
Heiko Schocherb11f53f2011-03-15 16:52:29 +010023#define CONFIG_HUSH_INIT_VAR
Heiko Schocher1e8f4e72008-11-20 09:59:09 +010024
Holger Brunck499b1a42011-04-08 02:47:46 +000025#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 }
Heiko Schocher1e8f4e72008-11-20 09:59:09 +010026
Heiko Schocherb11f53f2011-03-15 16:52:29 +010027#define CONFIG_LOADS_ECHO
28#define CONFIG_SYS_LOADS_BAUD_CHANGE
Heiko Schocher1e8f4e72008-11-20 09:59:09 +010029
Holger Brunck7f704602015-11-13 16:15:19 +010030
Heiko Schocher364123d2009-03-12 07:37:18 +010031/* Support the IVM EEprom */
32#define CONFIG_SYS_IVM_EEPROM_ADR 0x50
33#define CONFIG_SYS_IVM_EEPROM_MAX_LEN 0x400
34#define CONFIG_SYS_IVM_EEPROM_PAGE_LEN 0x100
35
Heiko Schocher1e8f4e72008-11-20 09:59:09 +010036/*
37 * BOOTP options
38 */
39#define CONFIG_BOOTP_BOOTFILESIZE
Heiko Schocher1e8f4e72008-11-20 09:59:09 +010040
Heiko Schocherdc71b242009-07-09 12:04:18 +020041/* UBI Support for all Keymile boards */
Heiko Schocherdc71b242009-07-09 12:04:18 +020042#define CONFIG_MTD_CONCAT
43
Holger Bruncka21b5d42011-03-04 14:56:27 +010044#ifndef CONFIG_KM_DEF_ENV_BOOTPARAMS
45#define CONFIG_KM_DEF_ENV_BOOTPARAMS \
Holger Brunckdb0bb572011-07-04 21:27:16 +000046 "actual_bank=0\0"
Heiko Schocher364123d2009-03-12 07:37:18 +010047#endif
48
Holger Brunckde3ad132011-03-14 16:01:04 +010049#ifndef CONFIG_KM_DEF_NETDEV
50#define CONFIG_KM_DEF_NETDEV \
51 "netdev=eth0\0"
52#endif
53
Andreas Hubercf736392012-05-04 10:30:16 +020054#ifndef CONFIG_KM_UBI_PARTITION_NAME_BOOT
55#define CONFIG_KM_UBI_PARTITION_NAME_BOOT "ubi0"
56#endif /* CONFIG_KM_UBI_PARTITION_NAME_BOOT */
57
Valentin Longchampcf7707a2014-01-27 11:49:10 +010058#ifndef CONFIG_KM_UBI_PART_BOOT_OPTS
59#define CONFIG_KM_UBI_PART_BOOT_OPTS ""
60#endif /* CONFIG_KM_UBI_PART_BOOT_OPTS */
61
Andreas Hubercf736392012-05-04 10:30:16 +020062#ifndef CONFIG_KM_UBI_PARTITION_NAME_APP
63/* one flash chip only called boot */
64/* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
65# define CONFIG_KM_UBI_LINUX_MTD \
Valentin Longchampcf7707a2014-01-27 11:49:10 +010066 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT \
67 CONFIG_KM_UBI_PART_BOOT_OPTS
Andreas Hubercf736392012-05-04 10:30:16 +020068# define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI \
69 "ubiattach=ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "\0"
70#else /* CONFIG_KM_UBI_PARTITION_NAME_APP */
71/* two flash chips called boot and app */
72/* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
73/* app: CONFIG_KM_UBI_PARTITION_NAME_APP */
74# define CONFIG_KM_UBI_LINUX_MTD \
Valentin Longchampcf7707a2014-01-27 11:49:10 +010075 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT \
76 CONFIG_KM_UBI_PART_BOOT_OPTS " " \
Andreas Hubercf736392012-05-04 10:30:16 +020077 "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_APP
78# define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI \
79 "ubiattach=if test ${boot_bank} -eq 0; then; " \
80 "ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "; else; " \
81 "ubi part " CONFIG_KM_UBI_PARTITION_NAME_APP "; fi\0"
82#endif /* CONFIG_KM_UBI_PARTITION_NAME_APP */
Holger Brunckde3ad132011-03-14 16:01:04 +010083
Andreas Huberdacc1092013-01-21 03:55:20 +000084#ifdef CONFIG_NAND_ECC_BCH
85#define CONFIG_KM_UIMAGE_NAME "ecc_bch_uImage\0"
Holger Bruncka7bc9142013-01-21 03:55:24 +000086#define CONFIG_KM_ECC_MODE " eccmode=bch"
Andreas Huberdacc1092013-01-21 03:55:20 +000087#else
88#define CONFIG_KM_UIMAGE_NAME "uImage\0"
Holger Bruncka7bc9142013-01-21 03:55:24 +000089#define CONFIG_KM_ECC_MODE
Andreas Huberdacc1092013-01-21 03:55:20 +000090#endif
91
Holger Brunckde3ad132011-03-14 16:01:04 +010092/*
Holger Bruncka21b5d42011-03-04 14:56:27 +010093 * boottargets
Holger Brunckdb0bb572011-07-04 21:27:16 +000094 * - set 'subbootcmds'
Holger Bruncka21b5d42011-03-04 14:56:27 +010095 * - set 'bootcmd' and 'altbootcmd'
96 * available targets:
97 * - 'release': for a standalone system kernel/rootfs from flash
Holger Bruncka21b5d42011-03-04 14:56:27 +010098 */
99#define CONFIG_KM_DEF_ENV_BOOTTARGETS \
Valentin Longchampc6d32df2015-11-13 16:15:20 +0100100 "subbootcmds=ubiattach ubicopy checkfdt cramfsloadfdt " \
101 "set_fdthigh cramfsloadkernel flashargs add_default " \
102 "addpanic boot\0" \
Holger Brunckb648bfc2011-07-04 21:52:52 +0000103 "develop=" \
104 "tftp 200000 scripts/develop-${arch}.txt && " \
Holger Brunck2d9528e2011-05-04 01:47:34 +0000105 "env import -t 200000 ${filesize} && " \
Holger Brunckb648bfc2011-07-04 21:52:52 +0000106 "run setup_debug_env\0" \
107 "ramfs=" \
108 "tftp 200000 scripts/ramfs-${arch}.txt && " \
109 "env import -t 200000 ${filesize} && " \
110 "run setup_debug_env\0" \
Holger Bruncka21b5d42011-03-04 14:56:27 +0100111 ""
112
113/*
Holger Brunckde3ad132011-03-14 16:01:04 +0100114 * bootargs
115 * - modify 'bootargs'
116 *
Holger Brunckdb0bb572011-07-04 21:27:16 +0000117 * - 'add_default': default bootargs common for all arm/ppc boards
Holger Brunckde3ad132011-03-14 16:01:04 +0100118 * - 'addpanic': add kernel panic options
Holger Brunckde3ad132011-03-14 16:01:04 +0100119 * - 'flashargs': defaults arguments for flash base boot
120 *
Holger Brunckde3ad132011-03-14 16:01:04 +0100121 */
122#define CONFIG_KM_DEF_ENV_BOOTARGS \
Holger Brunckdb0bb572011-07-04 21:27:16 +0000123 "add_default=" \
Holger Brunckde3ad132011-03-14 16:01:04 +0100124 "setenv bootargs ${bootargs} " \
125 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
Valentin Longchamp7c3d6a22013-10-18 11:47:16 +0200126 ":${hostname}:${netdev}:off:" \
Holger Brunckdb0bb572011-07-04 21:27:16 +0000127 " console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}" \
Andreas Huber2a7714c2011-09-13 23:06:11 +0000128 " mem=${kernelmem} init=${init}" \
Holger Bruncka7bc9142013-01-21 03:55:24 +0000129 CONFIG_KM_ECC_MODE \
Marek Vasut93ea89f2012-09-23 17:41:23 +0200130 " phram.phram=phvar,${varaddr}," __stringify(CONFIG_KM_PHRAM)\
Andreas Hubercf736392012-05-04 10:30:16 +0200131 " " CONFIG_KM_UBI_LINUX_MTD " " \
Holger Brunckdb0bb572011-07-04 21:27:16 +0000132 CONFIG_KM_DEF_BOOT_ARGS_CPU \
133 "\0" \
Holger Brunckde3ad132011-03-14 16:01:04 +0100134 "addpanic=" \
Holger Brunck2d9528e2011-05-04 01:47:34 +0000135 "setenv bootargs ${bootargs} panic=1 panic_on_oops=1\0" \
Holger Brunckde3ad132011-03-14 16:01:04 +0100136 "flashargs=" \
137 "setenv bootargs " \
Thomas Herzmanne80ab3e2011-04-08 02:47:41 +0000138 "root=mtdblock:rootfs${boot_bank} " \
Holger Brunckde3ad132011-03-14 16:01:04 +0100139 "rootfstype=squashfs ro\0" \
140 ""
141
Holger Bruncka21b5d42011-03-04 14:56:27 +0100142/*
Holger Brunckde3ad132011-03-14 16:01:04 +0100143 * flash_boot
144 * - commands for booting from flash
145 *
Holger Brunckde3ad132011-03-14 16:01:04 +0100146 * - 'cramfsloadkernel': copy kernel from a cramfs to ram
147 * - 'ubiattach': attach ubi partition
148 * - 'ubicopy': copy ubi volume to ram
149 * - volume names: bootfs0, bootfs1, bootfs2, ...
Holger Brunckde3ad132011-03-14 16:01:04 +0100150 *
151 * processor specific settings
152 * - 'cramfsloadfdt': copy fdt from a cramfs to ram
153 */
154#define CONFIG_KM_DEF_ENV_FLASH_BOOT \
Marek Vasut93ea89f2012-09-23 17:41:23 +0200155 "cramfsaddr=" __stringify(CONFIG_KM_CRAMFS_ADDR) "\0" \
Andreas Huberdacc1092013-01-21 03:55:20 +0000156 "cramfsloadkernel=cramfsload ${load_addr_r} ${uimage}\0" \
Marek Vasut93ea89f2012-09-23 17:41:23 +0200157 "ubicopy=ubi read "__stringify(CONFIG_KM_CRAMFS_ADDR) \
Holger Brunck2d9528e2011-05-04 01:47:34 +0000158 " bootfs${boot_bank}\0" \
Andreas Huberdacc1092013-01-21 03:55:20 +0000159 "uimage=" CONFIG_KM_UIMAGE_NAME \
Andreas Hubercf736392012-05-04 10:30:16 +0200160 CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI
Holger Brunckde3ad132011-03-14 16:01:04 +0100161
162/*
163 * constants
164 * - KM specific constants and commands
165 *
166 * - 'default': setup default environment
167 */
168#define CONFIG_KM_DEF_ENV_CONSTANTS \
Thomas Herzmanne80ab3e2011-04-08 02:47:41 +0000169 "backup_bank=0\0" \
Holger Brunckdb0bb572011-07-04 21:27:16 +0000170 "release=run newenv; reset\0" \
Marek Vasut93ea89f2012-09-23 17:41:23 +0200171 "pnvramsize=" __stringify(CONFIG_KM_PNVRAM) "\0" \
Thomas Herzmann0333cfe2011-06-05 22:22:13 +0000172 "testbootcmd=setenv boot_bank ${test_bank}; " \
173 "run ${subbootcmds}; reset\0" \
Holger Brunckde3ad132011-03-14 16:01:04 +0100174 ""
175
Heiko Schocher364123d2009-03-12 07:37:18 +0100176#ifndef CONFIG_KM_DEF_ENV
177#define CONFIG_KM_DEF_ENV \
Holger Bruncka21b5d42011-03-04 14:56:27 +0100178 CONFIG_KM_DEF_ENV_BOOTPARAMS \
Holger Brunckde3ad132011-03-14 16:01:04 +0100179 CONFIG_KM_DEF_NETDEV \
180 CONFIG_KM_DEF_ENV_CPU \
Holger Bruncka21b5d42011-03-04 14:56:27 +0100181 CONFIG_KM_DEF_ENV_BOOTTARGETS \
Holger Brunckde3ad132011-03-14 16:01:04 +0100182 CONFIG_KM_DEF_ENV_BOOTARGS \
Holger Brunckde3ad132011-03-14 16:01:04 +0100183 CONFIG_KM_DEF_ENV_FLASH_BOOT \
Holger Bruncka21b5d42011-03-04 14:56:27 +0100184 CONFIG_KM_DEF_ENV_CONSTANTS \
Holger Brunckde3ad132011-03-14 16:01:04 +0100185 "altbootcmd=run bootcmd\0" \
Gerlando Falauto7b2268b2014-01-27 16:58:27 +0100186 "boot=bootm ${load_addr_r} - ${fdt_addr_r}\0" \
Holger Brunckdb0bb572011-07-04 21:27:16 +0000187 "bootcmd=km_checkbidhwk && " \
Thomas Herzmannc1b3d842012-05-04 10:55:58 +0200188 "setenv bootcmd \'if km_checktestboot; then; " \
189 "setenv boot_bank ${test_bank}; else; " \
190 "setenv boot_bank ${actual_bank}; fi;" \
Holger Brunckdb0bb572011-07-04 21:27:16 +0000191 "run ${subbootcmds}; reset\' && " \
192 "setenv altbootcmd \'setenv boot_bank ${backup_bank}; " \
193 "run ${subbootcmds}; reset\' && " \
194 "saveenv && saveenv && boot\0" \
Gerlando Falauto7b2268b2014-01-27 16:58:27 +0100195 "cramfsloadfdt=" \
196 "cramfsload ${fdt_addr_r} " \
197 "fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb\0" \
198 "fdt_addr_r="__stringify(CONFIG_KM_FDT_ADDR) "\0" \
Holger Brunckde3ad132011-03-14 16:01:04 +0100199 "init=/sbin/init-overlay.sh\0" \
Marek Vasut93ea89f2012-09-23 17:41:23 +0200200 "load_addr_r="__stringify(CONFIG_KM_KERNEL_ADDR) "\0" \
Holger Brunckdb0bb572011-07-04 21:27:16 +0000201 "load=tftpboot ${load_addr_r} ${u-boot}\0" \
Tom Rini43ede0b2017-10-22 17:55:07 -0400202 "mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \
203 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
Heiko Schocher364123d2009-03-12 07:37:18 +0100204 ""
205#endif /* CONFIG_KM_DEF_ENV */
206
Heiko Schocher1e8f4e72008-11-20 09:59:09 +0100207#endif /* __CONFIG_KEYMILE_H */