diff options
author | Baruch Siach <baruch@tkos.co.il> | 2010-08-04 10:55:09 +0300 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2010-08-04 10:17:27 +0200 |
commit | 5114582e52a5e3ff91238dbfc649e3cb56df9d4f (patch) | |
tree | a136b657826772b0738970cc79f091d8170a657e /arch | |
parent | cada1c41bd05afc371d1c980f4550277ab14e14f (diff) | |
download | barebox-5114582e52a5e3ff91238dbfc649e3cb56df9d4f.tar.gz barebox-5114582e52a5e3ff91238dbfc649e3cb56df9d4f.tar.xz |
imx25: fix UID endianess
Apparently, the UID is little-endian. Reverse endianess, and add a note in
comment.
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r-- | 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 de70247b16..49fe958fd7 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; } |