[U-Boot] [PATCH v2 1/9] kmp204x: support for QRIO1 bootcounter

Valentin Longchamp valentin.longchamp at keymile.com
Mon Jan 27 11:49:04 CET 2014


From: Rainer Boschung <rainer.boschung at keymile.com>

- make use of the QRIO1 32bit register at 0x20 as bootcounter register
- check for BOOTCOUNT_MAGIC pattern when before bootcounter value is read

Signed-off-by: Rainer Boschung <rainer.boschung at keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longchamp at keymile.com>

---

Changes in v2:
- change bootcounter implementation to use generic driver

 board/keymile/kmp204x/kmp204x.c     | 20 --------------------
 include/configs/km/kmp204x-common.h |  6 ++++--
 2 files changed, 4 insertions(+), 22 deletions(-)

diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
index f02642a..20a3264 100644
--- a/board/keymile/kmp204x/kmp204x.c
+++ b/board/keymile/kmp204x/kmp204x.c
@@ -133,26 +133,6 @@ void qrio_prstcfg(u8 bit, u8 mode)
 	out_be32(qrio_base + PRSTCFG_OFF, prstcfg);
 }
 
-
-#define BOOTCOUNT_OFF	0x12
-
-void bootcount_store(ulong counter)
-{
-	u8 val;
-	void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
-
-	val = (counter <= 255) ? (u8)counter : 255;
-	out_8(qrio_base + BOOTCOUNT_OFF, val);
-}
-
-ulong bootcount_load(void)
-{
-	u8 val;
-	void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
-	val = in_8(qrio_base + BOOTCOUNT_OFF);
-	return val;
-}
-
 #define NUM_SRDS_BANKS	2
 #define PHY_RST		15
 
diff --git a/include/configs/km/kmp204x-common.h b/include/configs/km/kmp204x-common.h
index 50330cc..e33ac90 100644
--- a/include/configs/km/kmp204x-common.h
+++ b/include/configs/km/kmp204x-common.h
@@ -149,8 +149,6 @@ unsigned long get_board_sys_clk(unsigned long dummy);
 #define CONFIG_KM_KERNEL_ADDR	0x1000000	/* max kernel size 15.5Mbytes */
 #define CONFIG_KM_FDT_ADDR	0x1F80000	/* max dtb    size  0.5Mbytes */
 
-#define CONFIG_BOOTCOUNT_LIMIT
-
 /*
  * Local Bus Definitions
  */
@@ -207,6 +205,10 @@ 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_BOOTCOUNT_LIMIT
+#define CONFIG_SYS_BOOTCOUNT_ADDR	(CONFIG_SYS_QRIO_BASE + 0x20)
+
 #define CONFIG_BOARD_EARLY_INIT_F
 #define CONFIG_BOARD_EARLY_INIT_R	/* call board_early_init_r function */
 #define CONFIG_MISC_INIT_R
-- 
1.8.0.1



More information about the U-Boot mailing list