[U-Boot] [PATCH 19/37] board: ge: bx50v3: add i2c eeprom bootcount storage

Robert Beckett
2019-10-15T15:53:32Z

Add bootcount node, linking to i2c eeprom "bootcount" partitions for
storage.
Enable i2c eeprom bootcount backend storage.
Enable bootcount command and use it for failbootcmd.

Signed-off-by: Robert Beckett <bob.beckett@collabora.com>
---
arch/arm/dts/imx6q-bx50v3.dts | 7 ++++++-
configs/ge_bx50v3_defconfig | 6 +++---
include/configs/ge_bx50v3.h | 4 +---
3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/arch/arm/dts/imx6q-bx50v3.dts b/arch/arm/dts/imx6q-bx50v3.dts
index 4dd2ce3038..4d40980254 100644
--- a/arch/arm/dts/imx6q-bx50v3.dts
+++ b/arch/arm/dts/imx6q-bx50v3.dts
@@ -18,6 +18,11 @@
ethernet0 = &fec;
};

+ bootcount {
+ compatible = "u-boot,bootcount-i2c-eeprom";
+ i2c-eeprom = <&bootcount_eeprom>;
+ };
+
wdt-reboot {
compatible = "wdt-reboot";
wdt = <&wdog1>;
@@ -250,7 +255,7 @@
size = <1022>;
};

- bootcount {
+ bootcount_eeprom: bootcount {
offset = <1022>;
size = <2>;
};
diff --git a/configs/ge_bx50v3_defconfig b/configs/ge_bx50v3_defconfig
index 937b6af9fa..519b3e1bb1 100644
--- a/configs/ge_bx50v3_defconfig
+++ b/configs/ge_bx50v3_defconfig
@@ -3,7 +3,6 @@ CONFIG_ARCH_MX6=y
CONFIG_SYS_TEXT_BASE=0x17800000
CONFIG_TARGET_GE_BX50V3=y
CONFIG_NR_DRAM_BANKS=1
-CONFIG_SYS_BOOTCOUNT_ADDR=0x7000A000
# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
CONFIG_FIT=y
CONFIG_OF_BOARD_SETUP=y
@@ -23,6 +22,7 @@ CONFIG_CMD_MMC=y
CONFIG_CMD_PCI=y
CONFIG_CMD_SF=y
# CONFIG_CMD_NFS is not set
+CONFIG_CMD_BOOTCOUNT=y
CONFIG_CMD_CACHE=y
CONFIG_CMD_EXT2=y
CONFIG_CMD_EXT4=y
@@ -34,9 +34,9 @@ CONFIG_DEFAULT_DEVICE_TREE="imx6q-bx50v3"
CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_DM=y
CONFIG_BOOTCOUNT_LIMIT=y
-CONFIG_BOOTCOUNT_EXT=y
+CONFIG_DM_BOOTCOUNT=y
+CONFIG_DM_BOOTCOUNT_I2C_EEPROM=y
CONFIG_BOOTCOUNT_BOOTLIMIT=10
-CONFIG_SYS_BOOTCOUNT_EXT_DEVPART="1:5"
CONFIG_DM_GPIO=y
CONFIG_DM_I2C=y
CONFIG_DM_I2C_COMPAT=y
diff --git a/include/configs/ge_bx50v3.h b/include/configs/ge_bx50v3.h
index f5e11aa465..b2c114409d 100644
--- a/include/configs/ge_bx50v3.h
+++ b/include/configs/ge_bx50v3.h
@@ -109,9 +109,7 @@
"setcurs 5 4; " \
"lcdputs \"Monitor failed to start. " \
"Try again, or contact GE Service for support.\"; " \
- "mw.b 0x7000A000 0xbc; " \
- "mw.b 0x7000A001 0x00; " \
- "ext4write ${dev} ${devnum}:5 0x7000A000 /boot/failures 2\0" \
+ "bootcount reset; \0" \
"altbootcmd=" \
"run doquiet; " \
"setenv partnum 1; run hasfirstboot || setenv partnum 2; " \
--
2.20.1