aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README32
-rw-r--r--arch/arm/dts/Makefile1
-rw-r--r--arch/arm/dts/imx6qdl-icore-rqs.dtsi2
-rw-r--r--arch/arm/dts/imx6ul-isiot-mmc.dts50
-rw-r--r--arch/arm/include/asm/mach-imx/hab.h27
-rw-r--r--arch/arm/mach-imx/hab.c220
-rw-r--r--arch/arm/mach-imx/mx6/Kconfig1
-rw-r--r--arch/arm/mach-imx/spl.c23
-rw-r--r--board/compulab/cm_fx6/spl.c2
-rw-r--r--board/engicam/imx6q/MAINTAINERS8
-rw-r--r--board/engicam/imx6ul/MAINTAINERS1
-rw-r--r--configs/calimain_defconfig1
-rw-r--r--configs/dh_imx6_defconfig1
-rw-r--r--configs/draco_defconfig1
-rw-r--r--configs/etamin_defconfig1
-rw-r--r--configs/ge_b450v3_defconfig3
-rw-r--r--configs/ge_b650v3_defconfig3
-rw-r--r--configs/ge_b850v3_defconfig3
-rw-r--r--configs/highbank_defconfig1
-rw-r--r--configs/ids8313_defconfig2
-rw-r--r--configs/imx6dl_icore_nand_defconfig47
-rw-r--r--configs/imx6q_icore_nand_defconfig (renamed from configs/imx6ul_isiot_mmc_defconfig)23
-rw-r--r--configs/imx6qdl_icore_mipi_defconfig2
-rw-r--r--configs/imx6qdl_icore_mmc_defconfig2
-rw-r--r--configs/imx6qdl_icore_rqs_defconfig2
-rw-r--r--configs/imx6ul_geam_mmc_defconfig1
-rw-r--r--configs/imx6ul_isiot_emmc_defconfig3
-rw-r--r--configs/km_kirkwood_128m16_defconfig1
-rw-r--r--configs/km_kirkwood_defconfig1
-rw-r--r--configs/km_kirkwood_pci_defconfig1
-rw-r--r--configs/kmcoge4_defconfig1
-rw-r--r--configs/kmcoge5ne_defconfig1
-rw-r--r--configs/kmcoge5un_defconfig1
-rw-r--r--configs/kmeter1_defconfig1
-rw-r--r--configs/kmlion1_defconfig1
-rw-r--r--configs/kmnusa_defconfig1
-rw-r--r--configs/kmopti2_defconfig1
-rw-r--r--configs/kmsugp1_defconfig1
-rw-r--r--configs/kmsupx5_defconfig1
-rw-r--r--configs/kmsuv31_defconfig1
-rw-r--r--configs/kmtegr1_defconfig1
-rw-r--r--configs/kmtepr2_defconfig1
-rw-r--r--configs/kmvect1_defconfig1
-rw-r--r--configs/mgcoge3un_defconfig1
-rw-r--r--configs/mx53ppd_defconfig2
-rw-r--r--configs/mx6sabresd_defconfig1
-rw-r--r--configs/portl2_defconfig1
-rw-r--r--configs/pxm2_defconfig1
-rw-r--r--configs/rastaban_defconfig1
-rw-r--r--configs/rut_defconfig1
-rw-r--r--configs/socfpga_is1_defconfig1
-rw-r--r--configs/socfpga_sr1500_defconfig1
-rw-r--r--configs/suvd3_defconfig1
-rw-r--r--configs/theadorable_debug_defconfig1
-rw-r--r--configs/thuban_defconfig1
-rw-r--r--configs/tqma6s_wru4_mmc_defconfig1
-rw-r--r--configs/tuge1_defconfig1
-rw-r--r--configs/tuxx1_defconfig1
-rw-r--r--configs/x600_defconfig1
-rw-r--r--drivers/bootcount/Kconfig95
-rw-r--r--drivers/bootcount/Makefile5
-rw-r--r--drivers/bootcount/bootcount.c16
-rw-r--r--include/configs/am335x_evm.h1
-rw-r--r--include/configs/am335x_sl50.h1
-rw-r--r--include/configs/baltos.h2
-rw-r--r--include/configs/bav335x.h1
-rw-r--r--include/configs/brppt1.h4
-rw-r--r--include/configs/calimain.h1
-rw-r--r--include/configs/chiliboard.h1
-rw-r--r--include/configs/dh_imx6.h1
-rw-r--r--include/configs/ge_bx50v3.h6
-rw-r--r--include/configs/highbank.h1
-rw-r--r--include/configs/ids8313.h5
-rw-r--r--include/configs/km/km_arm.h2
-rw-r--r--include/configs/km/kmp204x-common.h3
-rw-r--r--include/configs/siemens-am33x-common.h2
-rw-r--r--include/configs/socfpga_is1.h2
-rw-r--r--include/configs/socfpga_sr1500.h2
-rw-r--r--include/configs/theadorable.h1
-rw-r--r--include/configs/ti_am335x_common.h7
-rw-r--r--include/configs/tqma6_wru4.h1
-rw-r--r--include/configs/x600.h4
-rw-r--r--scripts/config_whitelist.txt7
83 files changed, 359 insertions, 308 deletions
diff --git a/README b/README
index cce59ad7c0..5cf90a482a 100644
--- a/README
+++ b/README
@@ -713,17 +713,6 @@ The following options need to be configured:
as a convenience, when switching between booting from
RAM and NFS.
-- Bootcount:
- CONFIG_BOOTCOUNT_ENV
- If no softreset save registers are found on the hardware
- "bootcount" is stored in the environment. To prevent a
- saveenv on all reboots, the environment variable
- "upgrade_available" is used. If "upgrade_available" is
- 0, "bootcount" is always 0, if "upgrade_available" is
- 1 "bootcount" is incremented in the environment.
- So the Userspace Applikation must set the "upgrade_available"
- and "bootcount" variable to 0, if a boot was successfully.
-
- Pre-Boot Commands:
CONFIG_PREBOOT
@@ -2278,27 +2267,6 @@ The following options need to be configured:
A better solution is to properly configure the firewall,
but sometimes that is not allowed.
-- bootcount support:
- CONFIG_AT91SAM9XE
- enable special bootcounter support on at91sam9xe based boards.
- CONFIG_SOC_DA8XX
- enable special bootcounter support on da850 based boards.
- CONFIG_BOOTCOUNT_RAM
- enable support for the bootcounter in RAM
- CONFIG_BOOTCOUNT_I2C
- enable support for the bootcounter on an i2c (like RTC) device.
- CONFIG_SYS_I2C_RTC_ADDR = i2c chip address
- CONFIG_SYS_BOOTCOUNT_ADDR = i2c addr which is used for
- the bootcounter.
- CONFIG_BOOTCOUNT_ALEN = address len
- CONFIG_BOOTCOUNT_EXT
- enable support for the bootcounter in EXT filesystem
- CONFIG_SYS_BOOTCOUNT_ADDR = RAM address used for read
- and write.
- CONFIG_SYS_BOOTCOUNT_EXT_INTERFACE = interface
- CONFIG_SYS_BOOTCOUNT_EXT_DEVPART = device and part
- CONFIG_SYS_BOOTCOUNT_EXT_NAME = filename
-
- Show boot progress:
CONFIG_SHOW_BOOT_PROGRESS
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index c7695aa1f1..e9fe71431c 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -396,7 +396,6 @@ dtb-$(CONFIG_MX6) += imx6ull-14x14-evk.dtb \
imx6sx-sdb.dtb \
imx6ul-geam-kit.dtb \
imx6ul-isiot-emmc.dtb \
- imx6ul-isiot-mmc.dtb \
imx6ul-isiot-nand.dtb \
imx6ul-opos6uldev.dtb
diff --git a/arch/arm/dts/imx6qdl-icore-rqs.dtsi b/arch/arm/dts/imx6qdl-icore-rqs.dtsi
index 816cdce2f3..1623838490 100644
--- a/arch/arm/dts/imx6qdl-icore-rqs.dtsi
+++ b/arch/arm/dts/imx6qdl-icore-rqs.dtsi
@@ -114,6 +114,7 @@
};
&usdhc4 {
+ u-boot,dm-spl;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_usdhc4>;
no-1-8-v;
@@ -183,6 +184,7 @@
};
pinctrl_usdhc4: usdhc4grp {
+ u-boot,dm-spl;
fsl,pins = <
MX6QDL_PAD_SD4_CMD__SD4_CMD 0x17070
MX6QDL_PAD_SD4_CLK__SD4_CLK 0x10070
diff --git a/arch/arm/dts/imx6ul-isiot-mmc.dts b/arch/arm/dts/imx6ul-isiot-mmc.dts
deleted file mode 100644
index bb5086a68a..0000000000
--- a/arch/arm/dts/imx6ul-isiot-mmc.dts
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2016 Amarula Solutions B.V.
- * Copyright (C) 2016 Engicam S.r.l.
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- * a) This file is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This file is distributed in the hope that it will be useful
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * Or, alternatively
- *
- * b) Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED , WITHOUT WARRANTY OF ANY KIND
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/dts-v1/;
-
-#include "imx6ul-isiot.dtsi"
-
-/ {
- model = "Engicam Is.IoT MX6UL MMC Starterkit";
- compatible = "engicam,imx6ul-isiot", "fsl,imx6ul";
-};
diff --git a/arch/arm/include/asm/mach-imx/hab.h b/arch/arm/include/asm/mach-imx/hab.h
index a0cb19db2f..561de9c6f7 100644
--- a/arch/arm/include/asm/mach-imx/hab.h
+++ b/arch/arm/include/asm/mach-imx/hab.h
@@ -38,6 +38,12 @@ struct ivt {
uint32_t reserved2; /* Reserved should be zero */
};
+struct __packed hab_hdr {
+ u8 tag; /* Tag field */
+ u8 len[2]; /* Length field in bytes (big-endian) */
+ u8 par; /* Parameters field */
+};
+
/* -------- start of HAB API updates ------------*/
/* The following are taken from HAB4 SIS */
@@ -162,7 +168,14 @@ typedef void hapi_clock_init_t(void);
#ifdef CONFIG_ROM_UNIFIED_SECTIONS
#define HAB_RVT_BASE 0x00000100
#else
-#define HAB_RVT_BASE 0x00000094
+#define HAB_RVT_BASE_NEW 0x00000098
+#define HAB_RVT_BASE_OLD 0x00000094
+#define HAB_RVT_BASE ((is_mx6dqp()) ? \
+ HAB_RVT_BASE_NEW : \
+ (is_mx6dq() && (soc_rev() >= CHIP_REV_1_5)) ? \
+ HAB_RVT_BASE_NEW : \
+ (is_mx6sdl() && (soc_rev() >= CHIP_REV_1_2)) ? \
+ HAB_RVT_BASE_NEW : HAB_RVT_BASE_OLD)
#endif
#define HAB_RVT_ENTRY (*(uint32_t *)(HAB_RVT_BASE + 0x04))
@@ -173,15 +186,15 @@ typedef void hapi_clock_init_t(void);
#define HAB_RVT_REPORT_STATUS (*(uint32_t *)(HAB_RVT_BASE + 0x24))
#define HAB_RVT_FAILSAFE (*(uint32_t *)(HAB_RVT_BASE + 0x28))
-#define HAB_RVT_REPORT_EVENT_NEW (*(uint32_t *)0x000000B8)
-#define HAB_RVT_REPORT_STATUS_NEW (*(uint32_t *)0x000000BC)
-#define HAB_RVT_AUTHENTICATE_IMAGE_NEW (*(uint32_t *)0x000000A8)
-#define HAB_RVT_ENTRY_NEW (*(uint32_t *)0x0000009C)
-#define HAB_RVT_EXIT_NEW (*(uint32_t *)0x000000A0)
-
#define HAB_CID_ROM 0 /**< ROM Caller ID */
#define HAB_CID_UBOOT 1 /**< UBOOT Caller ID*/
+#define HAB_CMD_HDR 0xD4 /* CSF Header */
+#define HAB_CMD_WRT_DAT 0xCC /* Write Data command tag */
+#define HAB_CMD_CHK_DAT 0xCF /* Check Data command tag */
+#define HAB_CMD_SET 0xB1 /* Set command tag */
+#define HAB_PAR_MID 0x01 /* MID parameter value */
+
#define IVT_SIZE 0x20
#define CSF_PAD_SIZE 0x2000
diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c
index 5f197775c1..c3fc699d02 100644
--- a/arch/arm/mach-imx/hab.c
+++ b/arch/arm/mach-imx/hab.c
@@ -13,96 +13,6 @@
#include <asm/arch/sys_proto.h>
#include <asm/mach-imx/hab.h>
-/* -------- start of HAB API updates ------------*/
-
-#define hab_rvt_report_event_p \
-( \
- (is_mx6dqp()) ? \
- ((hab_rvt_report_event_t *)HAB_RVT_REPORT_EVENT_NEW) : \
- (is_mx6dq() && (soc_rev() >= CHIP_REV_1_5)) ? \
- ((hab_rvt_report_event_t *)HAB_RVT_REPORT_EVENT_NEW) : \
- (is_mx6sdl() && (soc_rev() >= CHIP_REV_1_2)) ? \
- ((hab_rvt_report_event_t *)HAB_RVT_REPORT_EVENT_NEW) : \
- ((hab_rvt_report_event_t *)HAB_RVT_REPORT_EVENT) \
-)
-
-#define hab_rvt_report_status_p \
-( \
- (is_mx6dqp()) ? \
- ((hab_rvt_report_status_t *)HAB_RVT_REPORT_STATUS_NEW) :\
- (is_mx6dq() && (soc_rev() >= CHIP_REV_1_5)) ? \
- ((hab_rvt_report_status_t *)HAB_RVT_REPORT_STATUS_NEW) :\
- (is_mx6sdl() && (soc_rev() >= CHIP_REV_1_2)) ? \
- ((hab_rvt_report_status_t *)HAB_RVT_REPORT_STATUS_NEW) :\
- ((hab_rvt_report_status_t *)HAB_RVT_REPORT_STATUS) \
-)
-
-#define hab_rvt_authenticate_image_p \
-( \
- (is_mx6dqp()) ? \
- ((hab_rvt_authenticate_image_t *)HAB_RVT_AUTHENTICATE_IMAGE_NEW) : \
- (is_mx6dq() && (soc_rev() >= CHIP_REV_1_5)) ? \
- ((hab_rvt_authenticate_image_t *)HAB_RVT_AUTHENTICATE_IMAGE_NEW) : \
- (is_mx6sdl() && (soc_rev() >= CHIP_REV_1_2)) ? \
- ((hab_rvt_authenticate_image_t *)HAB_RVT_AUTHENTICATE_IMAGE_NEW) : \
- ((hab_rvt_authenticate_image_t *)HAB_RVT_AUTHENTICATE_IMAGE) \
-)
-
-#define hab_rvt_entry_p \
-( \
- (is_mx6dqp()) ? \
- ((hab_rvt_entry_t *)HAB_RVT_ENTRY_NEW) : \
- (is_mx6dq() && (soc_rev() >= CHIP_REV_1_5)) ? \
- ((hab_rvt_entry_t *)HAB_RVT_ENTRY_NEW) : \
- (is_mx6sdl() && (soc_rev() >= CHIP_REV_1_2)) ? \
- ((hab_rvt_entry_t *)HAB_RVT_ENTRY_NEW) : \
- ((hab_rvt_entry_t *)HAB_RVT_ENTRY) \
-)
-
-#define hab_rvt_exit_p \
-( \
- (is_mx6dqp()) ? \
- ((hab_rvt_exit_t *)HAB_RVT_EXIT_NEW) : \
- (is_mx6dq() && (soc_rev() >= CHIP_REV_1_5)) ? \
- ((hab_rvt_exit_t *)HAB_RVT_EXIT_NEW) : \
- (is_mx6sdl() && (soc_rev() >= CHIP_REV_1_2)) ? \
- ((hab_rvt_exit_t *)HAB_RVT_EXIT_NEW) : \
- ((hab_rvt_exit_t *)HAB_RVT_EXIT) \
-)
-
-static inline void hab_rvt_failsafe_new(void)
-{
-}
-
-#define hab_rvt_failsafe_p \
-( \
- (is_mx6dqp()) ? \
- ((hab_rvt_failsafe_t *)hab_rvt_failsafe_new) : \
- (is_mx6dq() && (soc_rev() >= CHIP_REV_1_5)) ? \
- ((hab_rvt_failsafe_t *)hab_rvt_failsafe_new) : \
- (is_mx6sdl() && (soc_rev() >= CHIP_REV_1_2)) ? \
- ((hab_rvt_failsafe_t *)hab_rvt_failsafe_new) : \
- ((hab_rvt_failsafe_t *)HAB_RVT_FAILSAFE) \
-)
-
-static inline enum hab_status hab_rvt_check_target_new(enum hab_target target,
- const void *start,
- size_t bytes)
-{
- return HAB_SUCCESS;
-}
-
-#define hab_rvt_check_target_p \
-( \
- (is_mx6dqp()) ? \
- ((hab_rvt_check_target_t *)hab_rvt_check_target_new) : \
- (is_mx6dq() && (soc_rev() >= CHIP_REV_1_5)) ? \
- ((hab_rvt_check_target_t *)hab_rvt_check_target_new) : \
- (is_mx6sdl() && (soc_rev() >= CHIP_REV_1_2)) ? \
- ((hab_rvt_check_target_t *)hab_rvt_check_target_new) : \
- ((hab_rvt_check_target_t *)HAB_RVT_CHECK_TARGET) \
-)
-
#define ALIGN_SIZE 0x1000
#define MX6DQ_PU_IROM_MMU_EN_VAR 0x009024a8
#define MX6DLS_PU_IROM_MMU_EN_VAR 0x00901dd0
@@ -344,8 +254,9 @@ static int get_hab_status(void)
hab_rvt_report_event_t *hab_rvt_report_event;
hab_rvt_report_status_t *hab_rvt_report_status;
- hab_rvt_report_event = hab_rvt_report_event_p;
- hab_rvt_report_status = hab_rvt_report_status_p;
+ hab_rvt_report_event = (hab_rvt_report_event_t *)HAB_RVT_REPORT_EVENT;
+ hab_rvt_report_status =
+ (hab_rvt_report_status_t *)HAB_RVT_REPORT_STATUS;
if (imx_hab_is_enabled())
puts("\nSecure boot enabled\n");
@@ -424,7 +335,7 @@ static int do_hab_failsafe(cmd_tbl_t *cmdtp, int flag, int argc,
return 1;
}
- hab_rvt_failsafe = hab_rvt_failsafe_p;
+ hab_rvt_failsafe = (hab_rvt_failsafe_t *)HAB_RVT_FAILSAFE;
hab_rvt_failsafe();
return 0;
@@ -453,6 +364,103 @@ U_BOOT_CMD(
#endif /* !defined(CONFIG_SPL_BUILD) */
+/* Get CSF Header length */
+static int get_hab_hdr_len(struct hab_hdr *hdr)
+{
+ return (size_t)((hdr->len[0] << 8) + (hdr->len[1]));
+}
+
+/* Check whether addr lies between start and
+ * end and is within the length of the image
+ */
+static int chk_bounds(u8 *addr, size_t bytes, u8 *start, u8 *end)
+{
+ size_t csf_size = (size_t)((end + 1) - addr);
+
+ return (addr && (addr >= start) && (addr <= end) &&
+ (csf_size >= bytes));
+}
+
+/* Get Length of each command in CSF */
+static int get_csf_cmd_hdr_len(u8 *csf_hdr)
+{
+ if (*csf_hdr == HAB_CMD_HDR)
+ return sizeof(struct hab_hdr);
+
+ return get_hab_hdr_len((struct hab_hdr *)csf_hdr);
+}
+
+/* Check if CSF is valid */
+static bool csf_is_valid(struct ivt *ivt, ulong start_addr, size_t bytes)
+{
+ u8 *start = (u8 *)start_addr;
+ u8 *csf_hdr;
+ u8 *end;
+
+ size_t csf_hdr_len;
+ size_t cmd_hdr_len;
+ size_t offset = 0;
+
+ if (bytes != 0)
+ end = start + bytes - 1;
+ else
+ end = start;
+
+ /* Verify if CSF pointer content is zero */
+ if (!ivt->csf) {
+ puts("Error: CSF pointer is NULL\n");
+ return false;
+ }
+
+ csf_hdr = (u8 *)ivt->csf;
+
+ /* Verify if CSF Header exist */
+ if (*csf_hdr != HAB_CMD_HDR) {
+ puts("Error: CSF header command not found\n");
+ return false;
+ }
+
+ csf_hdr_len = get_hab_hdr_len((struct hab_hdr *)csf_hdr);
+
+ /* Check if the CSF lies within the image bounds */
+ if (!chk_bounds(csf_hdr, csf_hdr_len, start, end)) {
+ puts("Error: CSF lies outside the image bounds\n");
+ return false;
+ }
+
+ do {
+ struct hab_hdr *cmd;
+
+ cmd = (struct hab_hdr *)&csf_hdr[offset];
+
+ switch (cmd->tag) {
+ case (HAB_CMD_WRT_DAT):
+ puts("Error: Deprecated write command found\n");
+ return false;
+ case (HAB_CMD_CHK_DAT):
+ puts("Error: Deprecated check command found\n");
+ return false;
+ case (HAB_CMD_SET):
+ if (cmd->par == HAB_PAR_MID) {
+ puts("Error: Deprecated Set MID command found\n");
+ return false;
+ }
+ default:
+ break;
+ }
+
+ cmd_hdr_len = get_csf_cmd_hdr_len(&csf_hdr[offset]);
+ if (!cmd_hdr_len) {
+ puts("Error: Invalid command length\n");
+ return false;
+ }
+ offset += cmd_hdr_len;
+
+ } while (offset < csf_hdr_len);
+
+ return true;
+}
+
bool imx_hab_is_enabled(void)
{
struct imx_sec_config_fuse_t *fuse =
@@ -485,10 +493,11 @@ int imx_hab_authenticate_image(uint32_t ddr_start, uint32_t image_size,
struct ivt_header *ivt_hdr;
enum hab_status status;
- hab_rvt_authenticate_image = hab_rvt_authenticate_image_p;
- hab_rvt_entry = hab_rvt_entry_p;
- hab_rvt_exit = hab_rvt_exit_p;
- hab_rvt_check_target = hab_rvt_check_target_p;
+ hab_rvt_authenticate_image =
+ (hab_rvt_authenticate_image_t *)HAB_RVT_AUTHENTICATE_IMAGE;
+ hab_rvt_entry = (hab_rvt_entry_t *)HAB_RVT_ENTRY;
+ hab_rvt_exit = (hab_rvt_exit_t *)HAB_RVT_EXIT;
+ hab_rvt_check_target = (hab_rvt_check_target_t *)HAB_RVT_CHECK_TARGET;
if (!imx_hab_is_enabled()) {
puts("hab fuse not enabled\n");
@@ -507,18 +516,28 @@ int imx_hab_authenticate_image(uint32_t ddr_start, uint32_t image_size,
/* Verify IVT header bugging out on error */
if (verify_ivt_header(ivt_hdr))
- goto hab_caam_clock_disable;
+ goto hab_authentication_exit;
/* Verify IVT body */
if (ivt->self != ivt_addr) {
printf("ivt->self 0x%08x pointer is 0x%08x\n",
ivt->self, ivt_addr);
- goto hab_caam_clock_disable;
+ goto hab_authentication_exit;
+ }
+
+ /* Verify if IVT DCD pointer is NULL */
+ if (ivt->dcd) {
+ puts("Error: DCD pointer must be NULL\n");
+ goto hab_authentication_exit;
}
start = ddr_start;
bytes = image_size;
+ /* Verify CSF */
+ if (!csf_is_valid(ivt, start, bytes))
+ goto hab_authentication_exit;
+
if (hab_rvt_entry() != HAB_SUCCESS) {
puts("hab entry function fail\n");
goto hab_exit_failure_print_status;
@@ -591,8 +610,7 @@ hab_exit_failure_print_status:
get_hab_status();
#endif
-hab_caam_clock_disable:
- hab_caam_clock_enable(0);
+hab_authentication_exit:
if (load_addr != 0)
result = 0;
diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig
index 2f3e52d624..d4ce38db8d 100644
--- a/arch/arm/mach-imx/mx6/Kconfig
+++ b/arch/arm/mach-imx/mx6/Kconfig
@@ -238,7 +238,6 @@ config TARGET_MX6Q_ENGICAM
select DM_MMC
select DM_THERMAL
select SUPPORT_SPL
- select SPL_LOAD_FIT
select SPL_DM if SPL
select SPL_OF_CONTROL if SPL
select SPL_SEPARATE_BSS if SPL
diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
index a9079fceac..b2521b2101 100644
--- a/arch/arm/mach-imx/spl.c
+++ b/arch/arm/mach-imx/spl.c
@@ -132,6 +132,29 @@ int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
}
#endif
+#if defined(CONFIG_SPL_MMC_SUPPORT)
+/* called from spl_mmc to see type of boot mode for storage (RAW or FAT) */
+u32 spl_boot_mode(const u32 boot_device)
+{
+ switch (spl_boot_device()) {
+ /* for MMC return either RAW or FAT mode */
+ case BOOT_DEVICE_MMC1:
+ case BOOT_DEVICE_MMC2:
+#if defined(CONFIG_SPL_FAT_SUPPORT)
+ return MMCSD_MODE_FS;
+#elif defined(CONFIG_SUPPORT_EMMC_BOOT)
+ return MMCSD_MODE_EMMCBOOT;
+#else
+ return MMCSD_MODE_RAW;
+#endif
+ break;
+ default:
+ puts("spl: ERROR: unsupported device\n");
+ hang();
+ }
+}
+#endif
+
#if defined(CONFIG_SECURE_BOOT)
/*
diff --git a/board/compulab/cm_fx6/spl.c b/board/compulab/cm_fx6/spl.c
index 56aac60239..16e5bf8dfa 100644
--- a/board/compulab/cm_fx6/spl.c
+++ b/board/compulab/cm_fx6/spl.c
@@ -107,8 +107,6 @@ static struct mx6_ddr_sysinfo cm_fx6_sysinfo_s = {
.mif3_mode = 3,
.rst_to_cke = 0x23,
.sde_to_rst = 0x10,
- .refsel = 1, /* Refresh cycles at 32KHz */
- .refr = 7, /* 8 refresh commands per refresh cycle */
};
static struct mx6_ddr3_cfg cm_fx6_ddr3_cfg_s = {
diff --git a/board/engicam/imx6q/MAINTAINERS b/board/engicam/imx6q/MAINTAINERS
index 82efb462c0..71f794586f 100644
--- a/board/engicam/imx6q/MAINTAINERS
+++ b/board/engicam/imx6q/MAINTAINERS
@@ -4,11 +4,17 @@ S: Maintained
F: board/engicam/imx6q
F: include/configs/imx6-engicam.h
F: configs/imx6qdl_icore_mmc_defconfig
-F: configs/imx6qdl_icore_nand_defconfig
+F: configs/imx6q_icore_nand_defconfig
+F: configs/imx6dl_icore_nand_defconfig
F: configs/imx6qdl_icore_rqs_defconfig
+F: configs/imx6qdl_icore_mipi_defconfig
+F: configs/imx6qdl_icore_nand_defconfig
F: arch/arm/dts/imx6qdl-icore.dtsi
F: arch/arm/dts/imx6q-icore.dts
F: arch/arm/dts/imx6dl-icore.dts
F: arch/arm/dts/imx6qdl-icore-rqs.dtsi
F: arch/arm/dts/imx6q-icore-rqs.dts
F: arch/arm/dts/imx6dl-icore-rqs.dts
+F: arch/arm/dts/imx6dl-icore-mipi.dts
+F: arch/arm/dts/imx6q-icore-mipi.dts
+F: arch/arm/dts/imx6qdl-icore.dtsi
diff --git a/board/engicam/imx6ul/MAINTAINERS b/board/engicam/imx6ul/MAINTAINERS
index 37f84f8cc0..73dbec88e2 100644
--- a/board/engicam/imx6ul/MAINTAINERS
+++ b/board/engicam/imx6ul/MAINTAINERS
@@ -10,6 +10,5 @@ F: configs/imx6ul_isiot_mmc_defconfig
F: configs/imx6ul_isiot_nand_defconfig
F: arch/arm/dts/imx6ul-geam-kit.dts
F: arch/arm/dts/imx6ul-isiot.dtsi
-F: arch/arm/dts/imx6ul-isiot-mmc.dts
F: arch/arm/dts/imx6ul-isiot-emmc.dts
F: arch/arm/dts/imx6ul-isiot-nand.dts
diff --git a/configs/calimain_defconfig b/configs/calimain_defconfig
index cbb31f6bf3..234b1a5935 100644
--- a/configs/calimain_defconfig
+++ b/configs/calimain_defconfig
@@ -23,6 +23,7 @@ CONFIG_CMD_DIAG=y
CONFIG_ENV_IS_IN_FLASH=y
CONFIG_BOOTP_DNS=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_SYS_BOOTCOUNT_ADDR=0x01C23000
# CONFIG_MMC is not set
CONFIG_MTD_NOR_FLASH=y
CONFIG_SYS_NS16550=y
diff --git a/configs/dh_imx6_defconfig b/configs/dh_imx6_defconfig
index 251fcd01b6..2b4fe9c2c5 100644
--- a/configs/dh_imx6_defconfig
+++ b/configs/dh_imx6_defconfig
@@ -35,6 +35,7 @@ CONFIG_CMD_EXT4_WRITE=y
CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_DWC_AHSATA=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_SYS_BOOTCOUNT_ADDR=0x00900000
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_SPANSION=y
CONFIG_PHYLIB=y
diff --git a/configs/draco_defconfig b/configs/draco_defconfig
index 05b1b9e63c..985e662929 100644
--- a/configs/draco_defconfig
+++ b/configs/draco_defconfig
@@ -56,6 +56,7 @@ CONFIG_BOOTP_DNS=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_SUBNETMASK=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ENV=y
CONFIG_DFU_NAND=y
CONFIG_MMC_OMAP_HS=y
CONFIG_NAND=y
diff --git a/configs/etamin_defconfig b/configs/etamin_defconfig
index a9234ee8dd..dd862bb965 100644
--- a/configs/etamin_defconfig
+++ b/configs/etamin_defconfig
@@ -56,6 +56,7 @@ CONFIG_BOOTP_DNS=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_SUBNETMASK=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ENV=y
CONFIG_DFU_NAND=y
CONFIG_MMC_OMAP_HS=y
CONFIG_NAND=y
diff --git a/configs/ge_b450v3_defconfig b/configs/ge_b450v3_defconfig
index 2e28f89efe..045380b6de 100644
--- a/configs/ge_b450v3_defconfig
+++ b/configs/ge_b450v3_defconfig
@@ -27,6 +27,9 @@ CONFIG_CMD_FS_GENERIC=y
CONFIG_DOS_PARTITION=y
CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_EXT=y
+CONFIG_SYS_BOOTCOUNT_EXT_DEVPART="1:5"
+CONFIG_SYS_BOOTCOUNT_ADDR=0x7000A000
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_STMICRO=y
CONFIG_NETDEVICES=y
diff --git a/configs/ge_b650v3_defconfig b/configs/ge_b650v3_defconfig
index 610de32e7b..9d4b8aeebe 100644
--- a/configs/ge_b650v3_defconfig
+++ b/configs/ge_b650v3_defconfig
@@ -27,6 +27,9 @@ CONFIG_CMD_FS_GENERIC=y
CONFIG_DOS_PARTITION=y
CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_EXT=y
+CONFIG_SYS_BOOTCOUNT_EXT_DEVPART="1:5"
+CONFIG_SYS_BOOTCOUNT_ADDR=0x7000A000
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_STMICRO=y
CONFIG_NETDEVICES=y
diff --git a/configs/ge_b850v3_defconfig b/configs/ge_b850v3_defconfig
index 3e9c9bdfc8..94785681be 100644
--- a/configs/ge_b850v3_defconfig
+++ b/configs/ge_b850v3_defconfig
@@ -27,6 +27,9 @@ CONFIG_CMD_FS_GENERIC=y
CONFIG_DOS_PARTITION=y
CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_EXT=y
+CONFIG_SYS_BOOTCOUNT_EXT_DEVPART="1:5"
+CONFIG_SYS_BOOTCOUNT_ADDR=0x7000A000
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_STMICRO=y
CONFIG_NETDEVICES=y
diff --git a/configs/highbank_defconfig b/configs/highbank_defconfig
index 7b9c0e7d47..55f83ed1e1 100644
--- a/configs/highbank_defconfig
+++ b/configs/highbank_defconfig
@@ -17,6 +17,7 @@ CONFIG_ENV_IS_IN_NVRAM=y
CONFIG_SCSI_AHCI=y
CONFIG_BOOTCOUNT_LIMIT=y
CONFIG_SYS_BOOTCOUNT_SINGLEWORD=y
+CONFIG_SYS_BOOTCOUNT_ADDR=0xfff3cf0c
# CONFIG_MMC is not set
CONFIG_SCSI=y
CONFIG_OF_LIBFDT=y
diff --git a/configs/ids8313_defconfig b/configs/ids8313_defconfig
index 5557402e6a..44b411cc59 100644
--- a/configs/ids8313_defconfig
+++ b/configs/ids8313_defconfig
@@ -35,6 +35,8 @@ CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_HOSTNAME=y
CONFIG_BOOTP_SUBNETMASK=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_I2C=y
+CONFIG_SYS_BOOTCOUNT_ADDR=0x9
# CONFIG_MMC is not set
CONFIG_MTD_NOR_FLASH=y
CONFIG_PHYLIB=y
diff --git a/configs/imx6dl_icore_nand_defconfig b/configs/imx6dl_icore_nand_defconfig
new file mode 100644
index 0000000000..d17f9cfed9
--- /dev/null
+++ b/configs/imx6dl_icore_nand_defconfig
@@ -0,0 +1,47 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MX6=y
+CONFIG_SYS_TEXT_BASE=0x17800000
+CONFIG_SPL_GPIO_SUPPORT=y
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_TARGET_MX6Q_ENGICAM=y
+CONFIG_SPL_SERIAL_SUPPORT=y
+CONFIG_SPL_WATCHDOG_SUPPORT=y
+# CONFIG_CMD_BMODE is not set
+CONFIG_DEFAULT_DEVICE_TREE="imx6dl-icore"
+CONFIG_FIT=y
+CONFIG_FIT_SIGNATURE=y
+CONFIG_FIT_VERBOSE=y
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
+CONFIG_BOOTDELAY=3
+CONFIG_SPL=y
+CONFIG_SPL_DMA_SUPPORT=y
+CONFIG_HUSH_PARSER=y
+CONFIG_SYS_PROMPT="icorem6qdl> "
+CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_MTDIDS_DEFAULT="nand0=gpmi-nand"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=gpmi-nand:2m(spl),2m(uboot),1m(env),8m(kernel),1m(dtb),-(rootfs)"
+CONFIG_CMD_UBI=y
+CONFIG_ENV_IS_IN_NAND=y
+CONFIG_SYS_I2C_MXC=y
+CONFIG_NAND=y
+CONFIG_NAND_MXS=y
+CONFIG_PHYLIB=y
+CONFIG_PHY_SMSC=y
+CONFIG_FEC_MXC=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_IMX6=y
+CONFIG_MXC_UART=y
+CONFIG_IMX_THERMAL=y
+CONFIG_VIDEO=y
+CONFIG_VIDEO_IPUV3=y
diff --git a/configs/imx6ul_isiot_mmc_defconfig b/configs/imx6q_icore_nand_defconfig
index b6f36ee934..2a86059226 100644
--- a/configs/imx6ul_isiot_mmc_defconfig
+++ b/configs/imx6q_icore_nand_defconfig
@@ -1,16 +1,14 @@
CONFIG_ARM=y
CONFIG_ARCH_MX6=y
-CONFIG_SYS_TEXT_BASE=0x87800000
+CONFIG_SYS_TEXT_BASE=0x17800000
CONFIG_SPL_GPIO_SUPPORT=y
CONFIG_SPL_LIBCOMMON_SUPPORT=y
CONFIG_SPL_LIBGENERIC_SUPPORT=y
-CONFIG_SYS_MALLOC_F_LEN=0x2000
-CONFIG_TARGET_MX6UL_ENGICAM=y
+CONFIG_TARGET_MX6Q_ENGICAM=y
CONFIG_SPL_SERIAL_SUPPORT=y
-CONFIG_SPL_LIBDISK_SUPPORT=y
CONFIG_SPL_WATCHDOG_SUPPORT=y
# CONFIG_CMD_BMODE is not set
-CONFIG_DEFAULT_DEVICE_TREE="imx6ul-isiot-mmc"
+CONFIG_DEFAULT_DEVICE_TREE="imx6q-icore"
CONFIG_FIT=y
CONFIG_FIT_SIGNATURE=y
CONFIG_FIT_VERBOSE=y
@@ -18,10 +16,9 @@ CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
CONFIG_BOOTDELAY=3
CONFIG_SUPPORT_RAW_INITRD=y
CONFIG_SPL=y
-CONFIG_SPL_EXT_SUPPORT=y
+CONFIG_SPL_DMA_SUPPORT=y
CONFIG_HUSH_PARSER=y
-CONFIG_SYS_PROMPT="isiotmx6ul> "
-CONFIG_CRC32_VERIFY=y
+CONFIG_SYS_PROMPT="icorem6qdl> "
CONFIG_CMD_MEMTEST=y
CONFIG_CMD_GPIO=y
CONFIG_CMD_I2C=y
@@ -29,13 +26,17 @@ CONFIG_CMD_MMC=y
CONFIG_CMD_MII=y
CONFIG_CMD_PING=y
CONFIG_CMD_CACHE=y
-CONFIG_CMD_EXT2=y
CONFIG_CMD_EXT4=y
CONFIG_CMD_EXT4_WRITE=y
CONFIG_CMD_FAT=y
CONFIG_CMD_FS_GENERIC=y
-CONFIG_ENV_IS_IN_MMC=y
+CONFIG_MTDIDS_DEFAULT="nand0=gpmi-nand"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=gpmi-nand:2m(spl),2m(uboot),1m(env),8m(kernel),1m(dtb),-(rootfs)"
+CONFIG_CMD_UBI=y
+CONFIG_ENV_IS_IN_NAND=y
CONFIG_SYS_I2C_MXC=y
+CONFIG_NAND=y
+CONFIG_NAND_MXS=y
CONFIG_PHYLIB=y
CONFIG_PHY_SMSC=y
CONFIG_FEC_MXC=y
@@ -43,3 +44,5 @@ CONFIG_PINCTRL=y
CONFIG_PINCTRL_IMX6=y
CONFIG_MXC_UART=y
CONFIG_IMX_THERMAL=y
+CONFIG_VIDEO=y
+CONFIG_VIDEO_IPUV3=y
diff --git a/configs/imx6qdl_icore_mipi_defconfig b/configs/imx6qdl_icore_mipi_defconfig
index e79f29aeb6..208fc89b7e 100644
--- a/configs/imx6qdl_icore_mipi_defconfig
+++ b/configs/imx6qdl_icore_mipi_defconfig
@@ -19,7 +19,7 @@ CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
CONFIG_BOOTDELAY=3
CONFIG_SUPPORT_RAW_INITRD=y
CONFIG_SPL=y
-CONFIG_SPL_EXT_SUPPORT=y
+CONFIG_SPL_LOAD_FIT=y
CONFIG_SPL_OS_BOOT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="icorem6qdl-mipi> "
diff --git a/configs/imx6qdl_icore_mmc_defconfig b/configs/imx6qdl_icore_mmc_defconfig
index 3f7075767b..d386946df6 100644
--- a/configs/imx6qdl_icore_mmc_defconfig
+++ b/configs/imx6qdl_icore_mmc_defconfig
@@ -19,7 +19,7 @@ CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
CONFIG_BOOTDELAY=3
CONFIG_SUPPORT_RAW_INITRD=y
CONFIG_SPL=y
-CONFIG_SPL_EXT_SUPPORT=y
+CONFIG_SPL_LOAD_FIT=y
CONFIG_SPL_OS_BOOT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="icorem6qdl> "
diff --git a/configs/imx6qdl_icore_rqs_defconfig b/configs/imx6qdl_icore_rqs_defconfig
index 485b9bf02e..13f3455369 100644
--- a/configs/imx6qdl_icore_rqs_defconfig
+++ b/configs/imx6qdl_icore_rqs_defconfig
@@ -18,7 +18,7 @@ CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
CONFIG_BOOTDELAY=3
CONFIG_SUPPORT_RAW_INITRD=y
CONFIG_SPL=y
-CONFIG_SPL_EXT_SUPPORT=y
+CONFIG_SPL_LOAD_FIT=y
CONFIG_SPL_OS_BOOT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="icorem6qdl-rqs> "
diff --git a/configs/imx6ul_geam_mmc_defconfig b/configs/imx6ul_geam_mmc_defconfig
index e887327e21..b6d8680b08 100644
--- a/configs/imx6ul_geam_mmc_defconfig
+++ b/configs/imx6ul_geam_mmc_defconfig
@@ -18,7 +18,6 @@ CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
CONFIG_BOOTDELAY=3
CONFIG_SUPPORT_RAW_INITRD=y
CONFIG_SPL=y
-CONFIG_SPL_EXT_SUPPORT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="geam6ul> "
CONFIG_CRC32_VERIFY=y
diff --git a/configs/imx6ul_isiot_emmc_defconfig b/configs/imx6ul_isiot_emmc_defconfig
index 35e889283a..a9bfbfd254 100644
--- a/configs/imx6ul_isiot_emmc_defconfig
+++ b/configs/imx6ul_isiot_emmc_defconfig
@@ -18,12 +18,12 @@ CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
CONFIG_BOOTDELAY=3
CONFIG_SUPPORT_RAW_INITRD=y
CONFIG_SPL=y
-CONFIG_SPL_EXT_SUPPORT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="isiotmx6ul> "
CONFIG_CRC32_VERIFY=y
CONFIG_CMD_MEMTEST=y
CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
CONFIG_CMD_MMC=y
CONFIG_CMD_MII=y
CONFIG_CMD_PING=y
@@ -34,6 +34,7 @@ CONFIG_CMD_EXT4_WRITE=y
CONFIG_CMD_FAT=y
CONFIG_CMD_FS_GENERIC=y
CONFIG_ENV_IS_IN_MMC=y
+CONFIG_SYS_I2C_MXC=y
CONFIG_PHYLIB=y
CONFIG_PHY_SMSC=y
CONFIG_FEC_MXC=y
diff --git a/configs/km_kirkwood_128m16_defconfig b/configs/km_kirkwood_128m16_defconfig
index 3c7709dbdc..653dc92ca3 100644
--- a/configs/km_kirkwood_128m16_defconfig
+++ b/configs/km_kirkwood_128m16_defconfig
@@ -30,6 +30,7 @@ CONFIG_BOOTP_BOOTPATH=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_HOSTNAME=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_RAM=y
# CONFIG_MMC is not set
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/km_kirkwood_defconfig b/configs/km_kirkwood_defconfig
index 04513a44b6..0a55ed407a 100644
--- a/configs/km_kirkwood_defconfig
+++ b/configs/km_kirkwood_defconfig
@@ -30,6 +30,7 @@ CONFIG_BOOTP_BOOTPATH=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_HOSTNAME=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_RAM=y
# CONFIG_MMC is not set
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/km_kirkwood_pci_defconfig b/configs/km_kirkwood_pci_defconfig
index 1e8f51135c..dba9eb7b7d 100644
--- a/configs/km_kirkwood_pci_defconfig
+++ b/configs/km_kirkwood_pci_defconfig
@@ -30,6 +30,7 @@ CONFIG_BOOTP_BOOTPATH=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_HOSTNAME=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_RAM=y
# CONFIG_MMC is not set
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/kmcoge4_defconfig b/configs/kmcoge4_defconfig
index fe731dc3c7..9d22c211a3 100644
--- a/configs/kmcoge4_defconfig
+++ b/configs/kmcoge4_defconfig
@@ -35,6 +35,7 @@ CONFIG_BOOTP_BOOTPATH=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_HOSTNAME=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_SYS_BOOTCOUNT_ADDR=0xFB000020
# CONFIG_MMC is not set
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/kmcoge5ne_defconfig b/configs/kmcoge5ne_defconfig
index c360d06a1e..3426adf598 100644
--- a/configs/kmcoge5ne_defconfig
+++ b/configs/kmcoge5ne_defconfig
@@ -28,6 +28,7 @@ CONFIG_BOOTP_BOOTPATH=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_HOSTNAME=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_SYS_BOOTCOUNT_ADDR=0xE011BFF8
# CONFIG_MMC is not set
CONFIG_MTD_NOR_FLASH=y
# CONFIG_PCI is not set
diff --git a/configs/kmcoge5un_defconfig b/configs/kmcoge5un_defconfig
index c7c0021131..63654c35cd 100644
--- a/configs/kmcoge5un_defconfig
+++ b/configs/kmcoge5un_defconfig
@@ -30,6 +30,7 @@ CONFIG_BOOTP_BOOTPATH=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_HOSTNAME=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_RAM=y
# CONFIG_MMC is not set
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/kmeter1_defconfig b/configs/kmeter1_defconfig
index 3e9ba80e99..e795ac40d1 100644
--- a/configs/kmeter1_defconfig
+++ b/configs/kmeter1_defconfig
@@ -27,6 +27,7 @@ CONFIG_BOOTP_BOOTPATH=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_HOSTNAME=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_SYS_BOOTCOUNT_ADDR=0xE011BFF8
# CONFIG_MMC is not set
CONFIG_MTD_NOR_FLASH=y
# CONFIG_PCI is not set
diff --git a/configs/kmlion1_defconfig b/configs/kmlion1_defconfig
index 9d4f3d7395..12c06cc544 100644
--- a/configs/kmlion1_defconfig
+++ b/configs/kmlion1_defconfig
@@ -35,6 +35,7 @@ CONFIG_BOOTP_BOOTPATH=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_HOSTNAME=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_SYS_BOOTCOUNT_ADDR=0xFB000020
# CONFIG_MMC is not set
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/kmnusa_defconfig b/configs/kmnusa_defconfig
index 960ca12cb3..0dd32016a1 100644
--- a/configs/kmnusa_defconfig
+++ b/configs/kmnusa_defconfig
@@ -30,6 +30,7 @@ CONFIG_BOOTP_BOOTPATH=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_HOSTNAME=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_RAM=y
# CONFIG_MMC is not set
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/kmopti2_defconfig b/configs/kmopti2_defconfig
index 484804ab0c..f3babb6a7e 100644
--- a/configs/kmopti2_defconfig
+++ b/configs/kmopti2_defconfig
@@ -27,6 +27,7 @@ CONFIG_BOOTP_BOOTPATH=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_HOSTNAME=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_SYS_BOOTCOUNT_ADDR=0xE0113FF8
# CONFIG_MMC is not set
CONFIG_MTD_NOR_FLASH=y
# CONFIG_PCI is not set
diff --git a/configs/kmsugp1_defconfig b/configs/kmsugp1_defconfig
index d5d5cd7b06..ed6540fed4 100644
--- a/configs/kmsugp1_defconfig
+++ b/configs/kmsugp1_defconfig
@@ -30,6 +30,7 @@ CONFIG_BOOTP_BOOTPATH=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_HOSTNAME=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_RAM=y
# CONFIG_MMC is not set
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/kmsupx5_defconfig b/configs/kmsupx5_defconfig
index 0a82ca3447..ac3f336204 100644
--- a/configs/kmsupx5_defconfig
+++ b/configs/kmsupx5_defconfig
@@ -27,6 +27,7 @@ CONFIG_BOOTP_BOOTPATH=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_HOSTNAME=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_SYS_BOOTCOUNT_ADDR=0xE0113FF8
# CONFIG_MMC is not set
CONFIG_MTD_NOR_FLASH=y
# CONFIG_PCI is not set
diff --git a/configs/kmsuv31_defconfig b/configs/kmsuv31_defconfig
index 33335cd408..b662077ef9 100644
--- a/configs/kmsuv31_defconfig
+++ b/configs/kmsuv31_defconfig
@@ -30,6 +30,7 @@ CONFIG_BOOTP_BOOTPATH=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_HOSTNAME=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_RAM=y
# CONFIG_MMC is not set
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/kmtegr1_defconfig b/configs/kmtegr1_defconfig
index 1b2d3df785..a5930ef6a7 100644
--- a/configs/kmtegr1_defconfig
+++ b/configs/kmtegr1_defconfig
@@ -29,6 +29,7 @@ CONFIG_BOOTP_BOOTPATH=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_HOSTNAME=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_SYS_BOOTCOUNT_ADDR=0xE0113FF8
# CONFIG_MMC is not set
CONFIG_MTD_NOR_FLASH=y
# CONFIG_PCI is not set
diff --git a/configs/kmtepr2_defconfig b/configs/kmtepr2_defconfig
index c3dcf86e32..7441e4a888 100644
--- a/configs/kmtepr2_defconfig
+++ b/configs/kmtepr2_defconfig
@@ -27,6 +27,7 @@ CONFIG_BOOTP_BOOTPATH=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_HOSTNAME=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_SYS_BOOTCOUNT_ADDR=0xE0113FF8
# CONFIG_MMC is not set
CONFIG_MTD_NOR_FLASH=y
# CONFIG_PCI is not set
diff --git a/configs/kmvect1_defconfig b/configs/kmvect1_defconfig
index 0dc165e312..b415c9d203 100644
--- a/configs/kmvect1_defconfig
+++ b/configs/kmvect1_defconfig
@@ -28,6 +28,7 @@ CONFIG_BOOTP_BOOTPATH=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_HOSTNAME=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_SYS_BOOTCOUNT_ADDR=0xE0113FF8
# CONFIG_MMC is not set
CONFIG_MTD_NOR_FLASH=y
# CONFIG_PCI is not set
diff --git a/configs/mgcoge3un_defconfig b/configs/mgcoge3un_defconfig
index 5c0946af7b..6a96b62eb5 100644
--- a/configs/mgcoge3un_defconfig
+++ b/configs/mgcoge3un_defconfig
@@ -30,6 +30,7 @@ CONFIG_BOOTP_BOOTPATH=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_HOSTNAME=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_RAM=y
# CONFIG_MMC is not set
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/mx53ppd_defconfig b/configs/mx53ppd_defconfig
index d321a777b0..f4a0b9b639 100644
--- a/configs/mx53ppd_defconfig
+++ b/configs/mx53ppd_defconfig
@@ -22,10 +22,10 @@ CONFIG_CMD_EXT4=y
CONFIG_CMD_EXT4_WRITE=y
CONFIG_CMD_FAT=y
CONFIG_CMD_FS_GENERIC=y
-CONFIG_BOOTCOUNT=y
CONFIG_BOOTCOUNT_LIMIT=y
CONFIG_BOOTCOUNT_EXT=y
CONFIG_SYS_BOOTCOUNT_EXT_DEVPART="0:5"
+CONFIG_SYS_BOOTCOUNT_ADDR=0x7000A000
CONFIG_NETDEVICES=y
CONFIG_RTC_S35392A=y
CONFIG_USB=y
diff --git a/configs/mx6sabresd_defconfig b/configs/mx6sabresd_defconfig
index 7c8187e78e..83b8bed52b 100644
--- a/configs/mx6sabresd_defconfig
+++ b/configs/mx6sabresd_defconfig
@@ -49,6 +49,7 @@ CONFIG_CMD_EXT4=y
CONFIG_CMD_EXT4_WRITE=y
CONFIG_CMD_FAT=y
CONFIG_CMD_FS_GENERIC=y
+CONFIG_EFI_PARTITION=y
CONFIG_ENV_IS_IN_MMC=y
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/portl2_defconfig b/configs/portl2_defconfig
index e3cf6378b7..6dc270a035 100644
--- a/configs/portl2_defconfig
+++ b/configs/portl2_defconfig
@@ -30,6 +30,7 @@ CONFIG_BOOTP_BOOTPATH=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_HOSTNAME=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_RAM=y
# CONFIG_MMC is not set
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/pxm2_defconfig b/configs/pxm2_defconfig
index e689d0f1cc..98edb8828c 100644
--- a/configs/pxm2_defconfig
+++ b/configs/pxm2_defconfig
@@ -59,6 +59,7 @@ CONFIG_BOOTP_DNS=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_SUBNETMASK=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ENV=y
CONFIG_DFU_NAND=y
CONFIG_MMC_OMAP_HS=y
CONFIG_NAND=y
diff --git a/configs/rastaban_defconfig b/configs/rastaban_defconfig
index 93e909cd20..e561edccf8 100644
--- a/configs/rastaban_defconfig
+++ b/configs/rastaban_defconfig
@@ -56,6 +56,7 @@ CONFIG_BOOTP_DNS=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_SUBNETMASK=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ENV=y
CONFIG_DFU_NAND=y
CONFIG_MMC_OMAP_HS=y
CONFIG_NAND=y
diff --git a/configs/rut_defconfig b/configs/rut_defconfig
index 9c879a96ab..e09f4c54e3 100644
--- a/configs/rut_defconfig
+++ b/configs/rut_defconfig
@@ -60,6 +60,7 @@ CONFIG_BOOTP_DNS=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_SUBNETMASK=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ENV=y
CONFIG_DFU_NAND=y
CONFIG_MMC_OMAP_HS=y
CONFIG_NAND=y
diff --git a/configs/socfpga_is1_defconfig b/configs/socfpga_is1_defconfig
index 4da9356baf..53b5c34fd4 100644
--- a/configs/socfpga_is1_defconfig
+++ b/configs/socfpga_is1_defconfig
@@ -34,6 +34,7 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_SPL_DM=y
CONFIG_SPL_DM_SEQ_ALIAS=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_SYS_BOOTCOUNT_ADDR=0xfffffff8
CONFIG_FPGA_SOCFPGA=y
CONFIG_DM_GPIO=y
CONFIG_DWAPB_GPIO=y
diff --git a/configs/socfpga_sr1500_defconfig b/configs/socfpga_sr1500_defconfig
index bdc12e4a6a..d7df688f50 100644
--- a/configs/socfpga_sr1500_defconfig
+++ b/configs/socfpga_sr1500_defconfig
@@ -38,6 +38,7 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_SPL_DM=y
CONFIG_SPL_DM_SEQ_ALIAS=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_SYS_BOOTCOUNT_ADDR=0xfffffff8
CONFIG_FPGA_SOCFPGA=y
CONFIG_DM_GPIO=y
CONFIG_DWAPB_GPIO=y
diff --git a/configs/suvd3_defconfig b/configs/suvd3_defconfig
index c75c802240..0213101d2f 100644
--- a/configs/suvd3_defconfig
+++ b/configs/suvd3_defconfig
@@ -27,6 +27,7 @@ CONFIG_BOOTP_BOOTPATH=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_HOSTNAME=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_SYS_BOOTCOUNT_ADDR=0xE0113FF8
# CONFIG_MMC is not set
CONFIG_MTD_NOR_FLASH=y
# CONFIG_PCI is not set
diff --git a/configs/theadorable_debug_defconfig b/configs/theadorable_debug_defconfig
index aa6e5e11ef..918447a296 100644
--- a/configs/theadorable_debug_defconfig
+++ b/configs/theadorable_debug_defconfig
@@ -45,6 +45,7 @@ CONFIG_NET_RANDOM_ETHADDR=y
CONFIG_SPL_OF_TRANSLATE=y
CONFIG_SATA_MV=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_RAM=y
CONFIG_FPGA_ALTERA=y
CONFIG_DM_GPIO=y
# CONFIG_MMC is not set
diff --git a/configs/thuban_defconfig b/configs/thuban_defconfig
index 197abde03f..eb7e2850ff 100644
--- a/configs/thuban_defconfig
+++ b/configs/thuban_defconfig
@@ -56,6 +56,7 @@ CONFIG_BOOTP_DNS=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_SUBNETMASK=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ENV=y
CONFIG_DFU_NAND=y
CONFIG_MMC_OMAP_HS=y
CONFIG_NAND=y
diff --git a/configs/tqma6s_wru4_mmc_defconfig b/configs/tqma6s_wru4_mmc_defconfig
index b6f5974fd4..995a1ced0f 100644
--- a/configs/tqma6s_wru4_mmc_defconfig
+++ b/configs/tqma6s_wru4_mmc_defconfig
@@ -34,6 +34,7 @@ CONFIG_CMD_FAT=y
CONFIG_CMD_FS_GENERIC=y
CONFIG_ENV_IS_IN_MMC=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_SYS_BOOTCOUNT_ADDR=0x00900000
CONFIG_LED_STATUS=y
CONFIG_LED_STATUS0=y
CONFIG_LED_STATUS_BIT=0
diff --git a/configs/tuge1_defconfig b/configs/tuge1_defconfig
index 262a5c5479..278d35ae61 100644
--- a/configs/tuge1_defconfig
+++ b/configs/tuge1_defconfig
@@ -27,6 +27,7 @@ CONFIG_BOOTP_BOOTPATH=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_HOSTNAME=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_SYS_BOOTCOUNT_ADDR=0xE0113FF8
# CONFIG_MMC is not set
CONFIG_MTD_NOR_FLASH=y
# CONFIG_PCI is not set
diff --git a/configs/tuxx1_defconfig b/configs/tuxx1_defconfig
index a2c101e275..6414ac2936 100644
--- a/configs/tuxx1_defconfig
+++ b/configs/tuxx1_defconfig
@@ -27,6 +27,7 @@ CONFIG_BOOTP_BOOTPATH=y
CONFIG_BOOTP_GATEWAY=y
CONFIG_BOOTP_HOSTNAME=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_SYS_BOOTCOUNT_ADDR=0xE0113FF8
# CONFIG_MMC is not set
CONFIG_MTD_NOR_FLASH=y
# CONFIG_PCI is not set
diff --git a/configs/x600_defconfig b/configs/x600_defconfig
index d1711e01fd..b63bf41c24 100644
--- a/configs/x600_defconfig
+++ b/configs/x600_defconfig
@@ -38,6 +38,7 @@ CONFIG_MTDPARTS_DEFAULT="mtdparts=nand:64M(ubi0),64M(ubi1)"
CONFIG_CMD_UBI=y
CONFIG_ENV_IS_IN_FLASH=y
CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_SYS_BOOTCOUNT_ADDR=0xD2801FF8
CONFIG_FPGA_XILINX=y
CONFIG_SYS_I2C_DW=y
# CONFIG_MMC is not set
diff --git a/drivers/bootcount/Kconfig b/drivers/bootcount/Kconfig
index d82289f57b..73972b7f9c 100644
--- a/drivers/bootcount/Kconfig
+++ b/drivers/bootcount/Kconfig
@@ -2,28 +2,28 @@
# Boot count configuration
#
-menu "Boot count support"
-
-config BOOTCOUNT
- bool "Enable Boot count support"
- help
- Enable boot count support, which provides the ability to store the
- number of times the board has booted on a number of different
- persistent storage mediums.
-
-config BOOTCOUNT_LIMIT
+menuconfig BOOTCOUNT_LIMIT
bool "Enable support for checking boot count limit"
help
Enable checking for exceeding the boot count limit.
More information: http://www.denx.de/wiki/DULG/UBootBootCountLimit
-config SYS_BOOTCOUNT_SINGLEWORD
- bool "Use single word to pack boot count and magic value"
+if BOOTCOUNT_LIMIT
+
+choice
+ prompt "Boot count device"
+ default BOOTCOUNT_AM33XX if AM33XX || SOC_DA8XX
+ default BOOTCOUNT_AT91 if AT91SAM9XE
+ default BOOTCOUNT_GENERIC
+
+config BOOTCOUNT_GENERIC
+ bool "Generic default boot counter"
help
- This option enables packing boot count magic value and boot count
- into single word (32 bits).
+ Generic bootcount stored at SYS_BOOTCOUNT_ADDR.
-if BOOTCOUNT
+ SYS_BOOTCOUNT_ADDR:
+ Set to the address where the bootcount and bootcount magic
+ will be stored.
config BOOTCOUNT_EXT
bool "Boot counter on EXT filesystem"
@@ -31,7 +31,60 @@ config BOOTCOUNT_EXT
Add support for maintaining boot count in a file on an EXT
filesystem.
-if BOOTCOUNT_EXT
+config BOOTCOUNT_AM33XX
+ bool "Boot counter in AM33XX RTC IP block"
+ depends on AM33XX || SOC_DA8XX
+ help
+ A bootcount driver for the RTC IP block found on many TI platforms.
+ This requires the RTC clocks, etc, to be enabled prior to use and
+ not all boards with this IP block on it will have the RTC in use.
+
+config BOOTCOUNT_ENV
+ bool "Boot counter in environment"
+ help
+ If no softreset save registers are found on the hardware
+ "bootcount" is stored in the environment. To prevent a
+ saveenv on all reboots, the environment variable
+ "upgrade_available" is used. If "upgrade_available" is
+ 0, "bootcount" is always 0, if "upgrade_available" is
+ 1 "bootcount" is incremented in the environment.
+ So the Userspace Application must set the "upgrade_available"
+ and "bootcount" variable to 0, if a boot was successfully.
+
+config BOOTCOUNT_RAM
+ bool "Boot counter in RAM"
+ help
+ Store the bootcount in DRAM protected against against bit errors
+ due to short power loss or holding a system in RESET.
+
+config BOOTCOUNT_I2C
+ bool "Boot counter on I2C device"
+ help
+ Enable support for the bootcounter on an i2c (like RTC) device.
+ CONFIG_SYS_I2C_RTC_ADDR = i2c chip address
+ CONFIG_SYS_BOOTCOUNT_ADDR = i2c addr which is used for
+ the bootcounter.
+
+config BOOTCOUNT_AT91
+ bool "Boot counter for Atmel AT91SAM9XE"
+ depends on AT91SAM9XE
+
+endchoice
+
+config BOOTCOUNT_ALEN
+ int "I2C address length"
+ default 1
+ depends on BOOTCOUNT_I2C
+ help
+ Length of the the I2C address at SYS_BOOTCOUNT_ADDR for storing
+ the boot counter.
+
+config SYS_BOOTCOUNT_SINGLEWORD
+ bool "Use single word to pack boot count and magic value"
+ depends on BOOTCOUNT_GENERIC
+ help
+ This option enables packing boot count magic value and boot count
+ into single word (32 bits).
config SYS_BOOTCOUNT_EXT_INTERFACE
string "Interface on which to find boot counter EXT filesystem"
@@ -58,13 +111,11 @@ config SYS_BOOTCOUNT_EXT_NAME
config SYS_BOOTCOUNT_ADDR
hex "RAM address used for reading and writing the boot counter"
- default 0x7000A000
- depends on BOOTCOUNT_EXT
+ default 0x44E3E000 if BOOTCOUNT_AM33XX
+ default 0xE0115FF8 if ARCH_LS1043A || ARCH_LS1021A
+ depends on BOOTCOUNT_AM33XX || BOOTCOUNT_GENERIC || BOOTCOUNT_EXT || \
+ BOOTCOUNT_I2C
help
Set the address used for reading and writing the boot counter.
endif
-
-endif
-
-endmenu
diff --git a/drivers/bootcount/Makefile b/drivers/bootcount/Makefile
index 45445d24bf..3e1ae8c884 100644
--- a/drivers/bootcount/Makefile
+++ b/drivers/bootcount/Makefile
@@ -2,9 +2,8 @@
# SPDX-License-Identifier: GPL-2.0+
#
-obj-y += bootcount.o
-obj-$(CONFIG_AT91SAM9XE) += bootcount_at91.o
-obj-$(CONFIG_SOC_DA8XX) += bootcount_davinci.o
+obj-$(CONFIG_BOOTCOUNT_GENERIC) += bootcount.o
+obj-$(CONFIG_BOOTCOUNT_AT91) += bootcount_at91.o
obj-$(CONFIG_BOOTCOUNT_AM33XX) += bootcount_davinci.o
obj-$(CONFIG_BOOTCOUNT_RAM) += bootcount_ram.o
obj-$(CONFIG_BOOTCOUNT_ENV) += bootcount_env.o
diff --git a/drivers/bootcount/bootcount.c b/drivers/bootcount/bootcount.c
index 8b499fe128..67554fa4a9 100644
--- a/drivers/bootcount/bootcount.c
+++ b/drivers/bootcount/bootcount.c
@@ -8,22 +8,7 @@
#include <bootcount.h>
#include <linux/compiler.h>
-/*
- * Only override CONFIG_SYS_BOOTCOUNT_ADDR if not already defined. This
- * way, some boards can define it directly in their config header.
- */
-#if !defined(CONFIG_SYS_BOOTCOUNT_ADDR)
-
-#if defined(CONFIG_QE)
-#include <linux/immap_qe.h>
-#define CONFIG_SYS_BOOTCOUNT_ADDR (CONFIG_SYS_IMMR + 0x110000 + \
- QE_MURAM_SIZE - 2 * sizeof(u32))
-#endif /* defined(CONFIG_QE) */
-
-#endif /* !defined(CONFIG_SYS_BOOTCOUNT_ADDR) */
-
/* Now implement the generic default functions */
-#if defined(CONFIG_SYS_BOOTCOUNT_ADDR)
__weak void bootcount_store(ulong a)
{
void *reg = (void *)CONFIG_SYS_BOOTCOUNT_ADDR;
@@ -54,4 +39,3 @@ __weak ulong bootcount_load(void)
return raw_bootcount_load(reg);
#endif /* defined(CONFIG_SYS_BOOTCOUNT_SINGLEWORD) */
}
-#endif /* defined(CONFIG_SYS_BOOTCOUNT_ADDR) */
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 2e1dbf6c01..80a523ddce 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -180,7 +180,6 @@
/* SPL */
#ifndef CONFIG_NOR_BOOT
/* Bootcount using the RTC block */
-#define CONFIG_BOOTCOUNT_AM33XX
#define CONFIG_SYS_BOOTCOUNT_BE
/* USB gadget RNDIS */
diff --git a/include/configs/am335x_sl50.h b/include/configs/am335x_sl50.h
index d44bc47004..569220ea35 100644
--- a/include/configs/am335x_sl50.h
+++ b/include/configs/am335x_sl50.h
@@ -72,7 +72,6 @@
/* SPL */
/* Bootcount using the RTC block */
-#define CONFIG_BOOTCOUNT_AM33XX
#define CONFIG_SYS_BOOTCOUNT_BE
#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_USBETH_SUPPORT)
diff --git a/include/configs/baltos.h b/include/configs/baltos.h
index 440dbf5367..10979c72ca 100644
--- a/include/configs/baltos.h
+++ b/include/configs/baltos.h
@@ -230,8 +230,6 @@
/* SPL */
#ifndef CONFIG_NOR_BOOT
-/* Bootcount using the RTC block */
-#define CONFIG_BOOTCOUNT_AM33XX
/* USB gadget RNDIS */
diff --git a/include/configs/bav335x.h b/include/configs/bav335x.h
index 5ea7658b52..48cd285d46 100644
--- a/include/configs/bav335x.h
+++ b/include/configs/bav335x.h
@@ -339,7 +339,6 @@ DEFAULT_LINUX_BOOT_ENV \
/* SPL */
#ifndef CONFIG_NOR_BOOT
/* Bootcount using the RTC block */
-#define CONFIG_BOOTCOUNT_AM33XX
#define CONFIG_SYS_BOOTCOUNT_BE
/* USB gadget RNDIS */
diff --git a/include/configs/brppt1.h b/include/configs/brppt1.h
index fb2845fb5d..02e989ad7a 100644
--- a/include/configs/brppt1.h
+++ b/include/configs/brppt1.h
@@ -20,10 +20,6 @@
#define CONFIG_LCD_DT_SIMPLEFB
#define LCD_BPP LCD_COLOR32
-/* Bootcount using the RTC block */
-#define CONFIG_SYS_BOOTCOUNT_ADDR 0x44E3E000
-#define CONFIG_BOOTCOUNT_AM33XX
-
/* memory */
#define CONFIG_SYS_MALLOC_LEN (5 * 1024 * 1024)
diff --git a/include/configs/calimain.h b/include/configs/calimain.h
index 854dc1ffed..364066feb2 100644
--- a/include/configs/calimain.h
+++ b/include/configs/calimain.h
@@ -274,7 +274,6 @@
#define CONFIG_SYS_INIT_SP_ADDR (0x8001ff00)
#define CONFIG_SYS_BOOTCOUNT_LE /* Use little-endian accessors */
-#define CONFIG_SYS_BOOTCOUNT_ADDR DAVINCI_RTC_BASE
#ifndef __ASSEMBLY__
int calimain_get_osc_freq(void);
diff --git a/include/configs/chiliboard.h b/include/configs/chiliboard.h
index 234cd6a4f6..92e0479f0a 100644
--- a/include/configs/chiliboard.h
+++ b/include/configs/chiliboard.h
@@ -123,7 +123,6 @@
/* SPL */
/* Bootcount using the RTC block */
-#define CONFIG_BOOTCOUNT_AM33XX
#define CONFIG_SYS_BOOTCOUNT_BE
/* NAND: device related configs */
diff --git a/include/configs/dh_imx6.h b/include/configs/dh_imx6.h
index 1f7fccad3f..abe393e44c 100644
--- a/include/configs/dh_imx6.h
+++ b/include/configs/dh_imx6.h
@@ -42,7 +42,6 @@
#define CONFIG_SYS_MALLOC_LEN (4 * SZ_1M)
/* Bootcounter */
-#define CONFIG_SYS_BOOTCOUNT_ADDR IRAM_BASE_ADDR
#define CONFIG_SYS_BOOTCOUNT_BE
/* FEC ethernet */
diff --git a/include/configs/ge_bx50v3.h b/include/configs/ge_bx50v3.h
index 110933f688..cbfe30d536 100644
--- a/include/configs/ge_bx50v3.h
+++ b/include/configs/ge_bx50v3.h
@@ -263,10 +263,4 @@
#define CONFIG_BCH
-#define CONFIG_BOOTCOUNT_EXT
-#define CONFIG_SYS_BOOTCOUNT_EXT_INTERFACE "mmc"
-#define CONFIG_SYS_BOOTCOUNT_EXT_DEVPART "1:5"
-#define CONFIG_SYS_BOOTCOUNT_EXT_NAME "/boot/failures"
-#define CONFIG_SYS_BOOTCOUNT_ADDR 0x7000A000
-
#endif /* __GE_BX50V3_CONFIG_H */
diff --git a/include/configs/highbank.h b/include/configs/highbank.h
index 0aa59bcafd..785cad7762 100644
--- a/include/configs/highbank.h
+++ b/include/configs/highbank.h
@@ -25,7 +25,6 @@
#define CONFIG_CONS_INDEX 0
#define CONFIG_SYS_BOOTCOUNT_LE /* Use little-endian accessors */
-#define CONFIG_SYS_BOOTCOUNT_ADDR 0xfff3cf0c
#define CONFIG_MISC_INIT_R
#define CONFIG_SCSI_AHCI_PLAT
diff --git a/include/configs/ids8313.h b/include/configs/ids8313.h
index 1769224c57..a4acaa65b2 100644
--- a/include/configs/ids8313.h
+++ b/include/configs/ids8313.h
@@ -508,11 +508,6 @@
/* UBI Support */
#define CONFIG_MTD_PARTITIONS
-/* bootcount support */
-#define CONFIG_BOOTCOUNT_I2C
-#define CONFIG_BOOTCOUNT_ALEN 1
-#define CONFIG_SYS_BOOTCOUNT_ADDR 0x9
-
#define CONFIG_IMAGE_FORMAT_LEGACY
#endif /* __CONFIG_H */
diff --git a/include/configs/km/km_arm.h b/include/configs/km/km_arm.h
index faa3d94a95..cc36a68c0b 100644
--- a/include/configs/km/km_arm.h
+++ b/include/configs/km/km_arm.h
@@ -276,8 +276,6 @@ int get_scl(void);
#define CONFIG_KM_RESERVED_PRAM 0x801000
/* address for the bootcount (taken from end of RAM) */
#define BOOTCOUNT_ADDR (CONFIG_KM_RESERVED_PRAM)
-/* Use generic bootcount RAM driver */
-#define CONFIG_BOOTCOUNT_RAM
/* enable POST tests */
#define CONFIG_POST (CONFIG_SYS_POST_MEM_REGIONS)
diff --git a/include/configs/km/kmp204x-common.h b/include/configs/km/kmp204x-common.h
index 7f735e0ac6..f49f436120 100644
--- a/include/configs/km/kmp204x-common.h
+++ b/include/configs/km/kmp204x-common.h
@@ -188,9 +188,6 @@ unsigned long get_board_sys_clk(unsigned long dummy);
#define CONFIG_SYS_BR1_PRELIM CONFIG_SYS_QRIO_BR_PRELIM /* QRIO Base Address */
#define CONFIG_SYS_OR1_PRELIM CONFIG_SYS_QRIO_OR_PRELIM /* QRIO Options */
-/* bootcounter in QRIO */
-#define CONFIG_SYS_BOOTCOUNT_ADDR (CONFIG_SYS_QRIO_BASE + 0x20)
-
#define CONFIG_BOARD_EARLY_INIT_R /* call board_early_init_r function */
#define CONFIG_MISC_INIT_F
#define CONFIG_MISC_INIT_R
diff --git a/include/configs/siemens-am33x-common.h b/include/configs/siemens-am33x-common.h
index 15dfeec98c..0e77ccb466 100644
--- a/include/configs/siemens-am33x-common.h
+++ b/include/configs/siemens-am33x-common.h
@@ -490,6 +490,4 @@
#define CONFIG_RESET_TO_RETRY
#define CONFIG_BOOT_RETRY_TIME 60
-#define CONFIG_BOOTCOUNT_ENV
-
#endif /* ! __CONFIG_SIEMENS_AM33X_COMMON_H */
diff --git a/include/configs/socfpga_is1.h b/include/configs/socfpga_is1.h
index f2c3f40554..88f9d4a46d 100644
--- a/include/configs/socfpga_is1.h
+++ b/include/configs/socfpga_is1.h
@@ -30,8 +30,6 @@
/*
* Bootcounter
*/
-/* last 2 lwords in OCRAM */
-#define CONFIG_SYS_BOOTCOUNT_ADDR 0xfffffff8
#define CONFIG_SYS_BOOTCOUNT_BE
#endif /* __CONFIG_SOCFPGA_IS1_H__ */
diff --git a/include/configs/socfpga_sr1500.h b/include/configs/socfpga_sr1500.h
index 8879817b30..492869bd37 100644
--- a/include/configs/socfpga_sr1500.h
+++ b/include/configs/socfpga_sr1500.h
@@ -29,8 +29,6 @@
/*
* Bootcounter
*/
-/* last 2 lwords in OCRAM */
-#define CONFIG_SYS_BOOTCOUNT_ADDR 0xfffffff8
#define CONFIG_SYS_BOOTCOUNT_BE
/* Environment setting for SPI flash */
diff --git a/include/configs/theadorable.h b/include/configs/theadorable.h
index a213e7e0a2..e4ec2c00f8 100644
--- a/include/configs/theadorable.h
+++ b/include/configs/theadorable.h
@@ -82,7 +82,6 @@
/*
* Bootcounter
*/
-#define CONFIG_BOOTCOUNT_RAM
/* Max size of RAM minus BOOTCOUNT_ADDR is the bootcounter address */
#define BOOTCOUNT_ADDR 0x1000
diff --git a/include/configs/ti_am335x_common.h b/include/configs/ti_am335x_common.h
index 6c93fd3f9b..8251ceb63f 100644
--- a/include/configs/ti_am335x_common.h
+++ b/include/configs/ti_am335x_common.h
@@ -38,13 +38,6 @@
#define CONFIG_DRIVER_TI_CPSW /* Driver for IP block */
/*
- * RTC related defines. To use bootcount you must set bootlimit in the
- * environment to a non-zero value and enable CONFIG_BOOTCOUNT_LIMIT
- * in the board config.
- */
-#define CONFIG_SYS_BOOTCOUNT_ADDR 0x44E3E000
-
-/*
* SPL related defines. The Public RAM memory map the ROM defines the
* area between 0x402F0400 and 0x4030B800 as a download area and
* 0x4030B800 to 0x4030CE00 as a public stack area. The ROM also
diff --git a/include/configs/tqma6_wru4.h b/include/configs/tqma6_wru4.h
index d94f790148..24b62e701c 100644
--- a/include/configs/tqma6_wru4.h
+++ b/include/configs/tqma6_wru4.h
@@ -34,7 +34,6 @@
/* LED */
/* Bootcounter */
-#define CONFIG_SYS_BOOTCOUNT_ADDR IRAM_BASE_ADDR
#define CONFIG_SYS_BOOTCOUNT_BE
#endif /* __CONFIG_TQMA6_WRU4_H */
diff --git a/include/configs/x600.h b/include/configs/x600.h
index 4bf8b1051e..485522cd87 100644
--- a/include/configs/x600.h
+++ b/include/configs/x600.h
@@ -116,10 +116,6 @@
#define CONFIG_SYS_MALLOC_LEN (8 << 20)
#define CONFIG_SYS_LOAD_ADDR 0x00800000
-/* Use last 2 lwords in internal SRAM for bootcounter */
-#define CONFIG_SYS_BOOTCOUNT_ADDR (CONFIG_SRAM_BASE + \
- CONFIG_SRAM_SIZE)
-
#define CONFIG_HOSTNAME x600
#define CONFIG_UBI_PART ubi0
#define CONFIG_UBIFS_VOLUME rootfs
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index e8f7c4c66a..a42b64d209 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -145,12 +145,6 @@ CONFIG_BOARD_TAURUS
CONFIG_BOARD_TYPES
CONFIG_BOOGER
CONFIG_BOOTBLOCK
-CONFIG_BOOTCOUNT_ALEN
-CONFIG_BOOTCOUNT_AM33XX
-CONFIG_BOOTCOUNT_ENV
-CONFIG_BOOTCOUNT_I2C
-CONFIG_BOOTCOUNT_LIMIT
-CONFIG_BOOTCOUNT_RAM
CONFIG_BOOTFILE
CONFIG_BOOTMAPSZ
CONFIG_BOOTMODE
@@ -2200,7 +2194,6 @@ CONFIG_SYS_BOARD_VERSION
CONFIG_SYS_BOOK3E_HV
CONFIG_SYS_BOOTCOUNT_BE
CONFIG_SYS_BOOTCOUNT_LE
-CONFIG_SYS_BOOTCOUNT_SINGLEWORD
CONFIG_SYS_BOOTFILE_PREFIX
CONFIG_SYS_BOOTMAPSZ
CONFIG_SYS_BOOTM_LEN