[U-Boot] [PATCH 1/2] powerpc/bootcount: Add bootcount support for MPC512x

From: Michael Weiss michael.weiss@ifm.com
This also uses the breadcrumb register as on MPC5200.
Signed-off-by: Michael Weiss michael.weiss@ifm.com Signed-off-by: Detlev Zundel dzu@denx.de --- arch/powerpc/lib/bootcount.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/lib/bootcount.c b/arch/powerpc/lib/bootcount.c index 6346527..0373a20 100644 --- a/arch/powerpc/lib/bootcount.c +++ b/arch/powerpc/lib/bootcount.c @@ -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)

From: Michael Weiss michael.weiss@ifm.com
For CONFIG_SYS_BOOTCOUNT_SINGLEWORD the code had an endianness problem.
Signed-off-by: Michael Weiss michael.weiss@ifm.com Signed-off-by: Detlev Zundel dzu@denx.de --- arch/powerpc/lib/bootcount.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/lib/bootcount.c b/arch/powerpc/lib/bootcount.c index 0373a20..07ef28d 100644 --- a/arch/powerpc/lib/bootcount.c +++ b/arch/powerpc/lib/bootcount.c @@ -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;

Dear Detlev Zundel,
In message 1274364575-9764-2-git-send-email-dzu@denx.de you wrote:
From: Michael Weiss michael.weiss@ifm.com
For CONFIG_SYS_BOOTCOUNT_SINGLEWORD the code had an endianness problem.
Signed-off-by: Michael Weiss michael.weiss@ifm.com Signed-off-by: Detlev Zundel dzu@denx.de
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

Dear Detlev Zundel,
In message 1274364575-9764-1-git-send-email-dzu@denx.de you wrote:
From: Michael Weiss michael.weiss@ifm.com
This also uses the breadcrumb register as on MPC5200.
Signed-off-by: Michael Weiss michael.weiss@ifm.com Signed-off-by: Detlev Zundel dzu@denx.de
arch/powerpc/lib/bootcount.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
Applied to "next" branch, thanks.
Best regards,
Wolfgang Denk
participants (2)
-
Detlev Zundel
-
Wolfgang Denk