mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Baruch Siach <baruch@tkos.co.il>
To: barebox@lists.infradead.org
Subject: [PATCH] imx25: fix UID endianess
Date: Wed,  4 Aug 2010 10:55:09 +0300	[thread overview]
Message-ID: <4c20bb0835da4ee29ec620cc895a64562b06ff2e.1280908400.git.baruch@tkos.co.il> (raw)

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

                 reply	other threads:[~2010-08-04  7:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4c20bb0835da4ee29ec620cc895a64562b06ff2e.1280908400.git.baruch@tkos.co.il \
    --to=baruch@tkos.co.il \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox