[U-Boot, 05/13] board: ge: mx53ppd: add i2c eeprom bootcount storage

Ian Ray ian.ray at ge.com
Fri Jan 31 14:07:56 CET 2020


From: Robert Beckett <bob.beckett at collabora.com>

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 at collabora.com>
---
 arch/arm/dts/imx53-ppd-uboot.dtsi | 7 ++++++-
 configs/mx53ppd_defconfig         | 6 +++---
 include/configs/mx53ppd.h         | 4 +---
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/arch/arm/dts/imx53-ppd-uboot.dtsi b/arch/arm/dts/imx53-ppd-uboot.dtsi
index 8e45ee7..0f81947 100644
--- a/arch/arm/dts/imx53-ppd-uboot.dtsi
+++ b/arch/arm/dts/imx53-ppd-uboot.dtsi
@@ -9,6 +9,11 @@
 		compatible = "wdt-reboot";
 		wdt = <&wdog1>;
 	};
+
+	bootcount {
+		compatible = "u-boot,bootcount-i2c-eeprom";
+		i2c-eeprom = <&bootcount>;
+	};
 };
 
 &eeprom {
@@ -20,7 +25,7 @@
 			size = <1022>;
 		};
 
-		bootcount {
+		bootcount: bootcount {
 			offset = <1022>;
 			size = <2>;
 		};
diff --git a/configs/mx53ppd_defconfig b/configs/mx53ppd_defconfig
index 4b479ae..0d499a3 100644
--- a/configs/mx53ppd_defconfig
+++ b/configs/mx53ppd_defconfig
@@ -5,7 +5,6 @@ CONFIG_TARGET_MX53PPD=y
 CONFIG_ENV_SIZE=0x2800
 CONFIG_ENV_OFFSET=0xC0000
 CONFIG_NR_DRAM_BANKS=2
-CONFIG_SYS_BOOTCOUNT_ADDR=0x7000A000
 CONFIG_FIT=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/ge/mx53ppd/imximage.cfg"
@@ -22,6 +21,7 @@ CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_DHCP=y
+CONFIG_CMD_BOOTCOUNT=y
 CONFIG_CMD_MII=y
 CONFIG_CMD_PING=y
 CONFIG_CMD_EXT2=y
@@ -35,9 +35,9 @@ CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=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="0:5"
 CONFIG_DM_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MXC=y
diff --git a/include/configs/mx53ppd.h b/include/configs/mx53ppd.h
index a11b085..e7eca82 100644
--- a/include/configs/mx53ppd.h
+++ b/include/configs/mx53ppd.h
@@ -98,9 +98,7 @@
 		"setenv stdout vga; " \
 		"echo \"\n\n\n\n    \" $msg; " \
 		"setenv stdout serial; " \
-		"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.10.1



More information about the U-Boot mailing list