[U-Boot] [PATCH V4 7/9] DM9000:Add a byte swap macro for dm9000 io operation.

Jason Jin Jason.jin at freescale.com
Thu Aug 25 09:46:43 CEST 2011


commit a45dde2293c816138e53c26eca6fd0322583f9a6 changed the dm9000
direct register access to standard IO. This should work
on the ColdFire platform as there are corresponding macros for
the LE devices. But the hardware settings on some ColdFire boards had
swapped the byte order which make the original macros such as out_le16
cannot work. To avoid changing the common io access code on ColdFire
platform, the DM9000_BYTE_SWAPPED define was added to make the dm9000 use
__raw* IO access on some ColdFire boards.

Signed-off-by: Jason Jin <Jason.jin at freescale.com>
---
Changes for V2: Remove the 'volatile' in the macro.

Changes for V3: Seperate the dm9000 code support and the platform
code to two patches so that it can be accepted by different custodian.

Resend: Add Ben Warren

Changes for V4: rename the DM9000_BYTE_SWAPPED to CONFIG_DM9000_BYTE_SWAPPED

 drivers/net/dm9000x.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c
index b5c5573..05cd8eb 100644
--- a/drivers/net/dm9000x.c
+++ b/drivers/net/dm9000x.c
@@ -116,13 +116,21 @@ static u8 DM9000_ior(int);
 static void DM9000_iow(int reg, u8 value);
 
 /* DM9000 network board routine ---------------------------- */
-
+#ifndef CONFIG_DM9000_BYTE_SWAPPED
 #define DM9000_outb(d,r) writeb(d, (volatile u8 *)(r))
 #define DM9000_outw(d,r) writew(d, (volatile u16 *)(r))
 #define DM9000_outl(d,r) writel(d, (volatile u32 *)(r))
 #define DM9000_inb(r) readb((volatile u8 *)(r))
 #define DM9000_inw(r) readw((volatile u16 *)(r))
 #define DM9000_inl(r) readl((volatile u32 *)(r))
+#else
+#define DM9000_outb(d, r) __raw_writeb(d, r)
+#define DM9000_outw(d, r) __raw_writew(d, r)
+#define DM9000_outl(d, r) __raw_writel(d, r)
+#define DM9000_inb(r) __raw_readb(r)
+#define DM9000_inw(r) __raw_readw(r)
+#define DM9000_inl(r) __raw_readl(r)
+#endif
 
 #ifdef CONFIG_DM9000_DEBUG
 static void
-- 
1.6.4




More information about the U-Boot mailing list