Skip to contentSkip to conversation

powerpc/bootcount: Add bootcount support for MPC512x

PATCH New Detlev Zundel 2 participants 4 messages May 20, 2010 – Jun 29, 2010 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 powerpc/bootcount: Add bootcount support for MPC512x

From: Michael Weiss <[email protected]>

This also uses the breadcrumb register as on MPC5200.

---
 arch/powerpc/lib/bootcount.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
arch/powerpc/lib/bootcount.c +5 -0
index 6346527..0373a20 100644
@@ -35,6 +35,11 @@
 #define CONFIG_SYS_BOOTCOUNT_SINGLEWORD
 #endif /* defined(CONFIG_MPC5xxx) */
 
+#if defined(CONFIG_MPC512X)
+#define CONFIG_SYS_BOOTCOUNT_ADDR	(&((immap_t *)CONFIG_SYS_IMMR)->clk.bcr)
+#define CONFIG_SYS_BOOTCOUNT_SINGLEWORD
+#endif /* defined(CONFIG_MPC512X) */
+
 #if defined(CONFIG_8xx)
 #define CONFIG_SYS_BOOTCOUNT_ADDR (((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_dpmem + \
 				CPM_BOOTCOUNT_ADDR)
Signature · 1 line
1.6.2.5
#1 lore raw

PATCH 2/2 powerpc/bootcount: Fix endianness problem

From: Michael Weiss <[email protected]>

For CONFIG_SYS_BOOTCOUNT_SINGLEWORD the code had an endianness problem.

---
 arch/powerpc/lib/bootcount.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
arch/powerpc/lib/bootcount.c +4 -2
index 0373a20..07ef28d 100644
@@ -82,10 +82,12 @@ ulong bootcount_load(void)
 	void *reg = (void *)CONFIG_SYS_BOOTCOUNT_ADDR;
 
 #if defined(CONFIG_SYS_BOOTCOUNT_SINGLEWORD)
-	if (in_be16(reg + 2) != (BOOTCOUNT_MAGIC & 0xffff))
+	u32 tmp = in_be32(reg);
+
+	if ((tmp & 0xffff0000) != (BOOTCOUNT_MAGIC & 0xffff0000))
 		return 0;
 	else
-		return in_be16(reg);
+		return (tmp & 0x0000ffff);
 #else
 	if (in_be32(reg + 4) != BOOTCOUNT_MAGIC)
 		return 0;
Signature · 1 line
1.6.2.5
#2 lore raw

PATCH 2/2 powerpc/bootcount: Fix endianness problem

Dear Detlev Zundel,

Quoted 9 lines · In message <[email protected]> you wrote:

From: Michael Weiss <[email protected]>

For CONFIG_SYS_BOOTCOUNT_SINGLEWORD the code had an endianness problem.

---
 arch/powerpc/lib/bootcount.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

Applied, thanks.

[Patch 1/2 is not a fix but new code, it is on hold for the "next" branch.]

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It is necessary to have purpose.
	-- Alice #1, "I, Mudd", stardate 4513.3
#3 lore raw

PATCH 1/2 powerpc/bootcount: Add bootcount support for MPC512x

In reply to Detlev Zundel

Dear Detlev Zundel,

Quoted 9 lines · In message <[email protected]> you wrote:

From: Michael Weiss <[email protected]>

This also uses the breadcrumb register as on MPC5200.

---
 arch/powerpc/lib/bootcount.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Applied to "next" branch, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I have a theory that it's impossible to prove anything, but  I  can't
prove it.