* [PATCH] imx25: fix UID endianess
@ 2010-08-04 7:55 Baruch Siach
0 siblings, 0 replies; only message in thread
From: Baruch Siach @ 2010-08-04 7:55 UTC (permalink / raw)
To: barebox
Apparently, the UID is little-endian. Reverse endianess, and add a note in
comment.
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
arch/arm/mach-imx/imx25.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-imx/imx25.c b/arch/arm/mach-imx/imx25.c
index de70247..70494aa 100644
--- a/arch/arm/mach-imx/imx25.c
+++ b/arch/arm/mach-imx/imx25.c
@@ -35,8 +35,14 @@ u64 imx_uid(void)
u64 uid = 0;
int i;
+ /*
+ * This code assumes that the UID is stored little-endian. The
+ * Freescale AN3682 document is silent about the endianess, but
+ * experimentation shows that this is the case. All other multi-byte
+ * values in IIM are big-endian as per AN3682.
+ */
for (i = 0; i < 8; i++)
- uid = (uid << 8) | readb(IMX_IIM_BASE + IIM_UID + i*4);
+ uid |= (u64)readb(IMX_IIM_BASE + IIM_UID + i*4) << (i*8);
return uid;
}
--
1.7.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-08-04 7:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-04 7:55 [PATCH] imx25: fix UID endianess Baruch Siach
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox