summaryrefslogtreecommitdiff
path: root/arch/powerpc/lib
diff options
context:
space:
mode:
authorMichael Weiss <michael.weiss@ifm.com>2010-05-20 16:09:35 +0200
committerWolfgang Denk <wd@denx.de>2010-05-26 22:26:32 +0200
commit59dde44acb82e571808190ccd3cd6b82dc9d7001 (patch)
tree49a49b314e45b59c65a11503f08a7ae4f66486dd /arch/powerpc/lib
parentd74dda09f0178079705ee1d641444bac44d3ecd9 (diff)
downloadu-boot-imx-59dde44acb82e571808190ccd3cd6b82dc9d7001.zip
u-boot-imx-59dde44acb82e571808190ccd3cd6b82dc9d7001.tar.gz
u-boot-imx-59dde44acb82e571808190ccd3cd6b82dc9d7001.tar.bz2
powerpc/bootcount: Fix endianness problem
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>
Diffstat (limited to 'arch/powerpc/lib')
-rw-r--r--arch/powerpc/lib/bootcount.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/powerpc/lib/bootcount.c b/arch/powerpc/lib/bootcount.c
index 6346527..338c848 100644
--- a/arch/powerpc/lib/bootcount.c
+++ b/arch/powerpc/lib/bootcount.c
@@ -77,10 +77,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;