[PATCH] imx25: fix UID endianess

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Apparently, the UID is little-endian. Reverse endianess, and add a note in
comment.

Signed-off-by: Baruch Siach <baruch@xxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox


[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux