public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] AX88180: use standard I/O accessors
@ 2010-05-11  6:43 Mike Frysinger
  2010-06-03  1:03 ` [U-Boot] [PATCH v2] " Mike Frysinger
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Frysinger @ 2010-05-11  6:43 UTC (permalink / raw)
  To: u-boot

The current dm9000x driver accesses its memory mapped registers directly
instead of using the standard I/O accessors.  This can cause problems on
Blackfin systems as the accesses can get out of order.  So convert the
direct volatile dereferences to use the normal in/out macros.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Tested-by: Hoan Hoang <hnhoan@i-syst.com>
---
 drivers/net/ax88180.h |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ax88180.h b/drivers/net/ax88180.h
index 9a324bd..7d75eb8 100644
--- a/drivers/net/ax88180.h
+++ b/drivers/net/ax88180.h
@@ -19,6 +19,7 @@
 #ifndef _AX88180_H_
 #define _AX88180_H_
 
+#include <asm/io.h>
 #include <asm/types.h>
 #include <config.h>
 
@@ -354,7 +355,7 @@ struct ax88180_private {
 
 static inline unsigned short INW (struct eth_device *dev, unsigned long addr)
 {
-	return le16_to_cpu (*(volatile unsigned short *) (addr + dev->iobase));
+	return le16_to_cpu(inw(addr + dev->iobase));
 }
 
 /*
@@ -363,32 +364,32 @@ static inline unsigned short INW (struct eth_device *dev, unsigned long addr)
 #if defined (CONFIG_DRIVER_AX88180_16BIT)
 static inline void OUTW (struct eth_device *dev, unsigned short command, unsigned long addr)
 {
-	*(volatile unsigned short *) ((addr + dev->iobase)) = cpu_to_le16 (command);
+	outw(cpu_to_le16(command), addr + dev->iobase);
 }
 
 static inline unsigned short READ_RXBUF (struct eth_device *dev)
 {
-	return le16_to_cpu (*(volatile unsigned short *) (RXBUFFER_START + dev->iobase));
+	return le16_to_cpu(inw(RXBUFFER_START + dev->iobase));
 }
 
 static inline void WRITE_TXBUF (struct eth_device *dev, unsigned short data)
 {
-	*(volatile unsigned short *) ((TXBUFFER_START + dev->iobase)) = cpu_to_le16 (data);
+	outw(cpu_to_le16(data), dev->iobase + TXBUFFER_START);
 }
 #else
 static inline void OUTW (struct eth_device *dev, unsigned short command, unsigned long addr)
 {
-	*(volatile unsigned long *) ((addr + dev->iobase)) = cpu_to_le32 (command);
+	outl(cpu_to_le32(command), addr + dev->iobase);
 }
 
 static inline unsigned long READ_RXBUF (struct eth_device *dev)
 {
-	return le32_to_cpu (*(volatile unsigned long *) (RXBUFFER_START + dev->iobase));
+	return le32_to_cpu(inl(RXBUFFER_START + dev->iobase));
 }
 
 static inline void WRITE_TXBUF (struct eth_device *dev, unsigned long data)
 {
-	*(volatile unsigned long *) ((TXBUFFER_START + dev->iobase)) = cpu_to_le32 (data);
+	outl(cpu_to_le32(data), dev->iobase + TXBUFFER_START);
 }
 #endif
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH v2] AX88180: use standard I/O accessors
  2010-05-11  6:43 [U-Boot] [PATCH] AX88180: use standard I/O accessors Mike Frysinger
@ 2010-06-03  1:03 ` Mike Frysinger
  2010-06-21  5:41   ` Ben Warren
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Frysinger @ 2010-06-03  1:03 UTC (permalink / raw)
  To: u-boot

The current dm9000x driver accesses its memory mapped registers directly
instead of using the standard I/O accessors.  This can cause problems on
Blackfin systems as the accesses can get out of order.  So convert the
direct volatile dereferences to use the normal in/out macros.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Tested-by: Hoan Hoang <hnhoan@i-syst.com>
---
v2
	- use read/write rather than in/out per recent discussions (see dm9000)

 drivers/net/ax88180.h |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ax88180.h b/drivers/net/ax88180.h
index 9a324bd..daf18e0 100644
--- a/drivers/net/ax88180.h
+++ b/drivers/net/ax88180.h
@@ -19,6 +19,7 @@
 #ifndef _AX88180_H_
 #define _AX88180_H_
 
+#include <asm/io.h>
 #include <asm/types.h>
 #include <config.h>
 
@@ -354,7 +355,7 @@ struct ax88180_private {
 
 static inline unsigned short INW (struct eth_device *dev, unsigned long addr)
 {
-	return le16_to_cpu (*(volatile unsigned short *) (addr + dev->iobase));
+	return le16_to_cpu(readw(addr + (void *)dev->iobase));
 }
 
 /*
@@ -363,32 +364,32 @@ static inline unsigned short INW (struct eth_device *dev, unsigned long addr)
 #if defined (CONFIG_DRIVER_AX88180_16BIT)
 static inline void OUTW (struct eth_device *dev, unsigned short command, unsigned long addr)
 {
-	*(volatile unsigned short *) ((addr + dev->iobase)) = cpu_to_le16 (command);
+	writew(cpu_to_le16(command), addr + (void *)dev->iobase);
 }
 
 static inline unsigned short READ_RXBUF (struct eth_device *dev)
 {
-	return le16_to_cpu (*(volatile unsigned short *) (RXBUFFER_START + dev->iobase));
+	return le16_to_cpu(readw(RXBUFFER_START + (void *)dev->iobase));
 }
 
 static inline void WRITE_TXBUF (struct eth_device *dev, unsigned short data)
 {
-	*(volatile unsigned short *) ((TXBUFFER_START + dev->iobase)) = cpu_to_le16 (data);
+	writew(cpu_to_le16(data), TXBUFFER_START + (void *)dev->iobase);
 }
 #else
 static inline void OUTW (struct eth_device *dev, unsigned short command, unsigned long addr)
 {
-	*(volatile unsigned long *) ((addr + dev->iobase)) = cpu_to_le32 (command);
+	writel(cpu_to_le32(command), addr + (void *)dev->iobase);
 }
 
 static inline unsigned long READ_RXBUF (struct eth_device *dev)
 {
-	return le32_to_cpu (*(volatile unsigned long *) (RXBUFFER_START + dev->iobase));
+	return le32_to_cpu(readl(RXBUFFER_START + (void *)dev->iobase));
 }
 
 static inline void WRITE_TXBUF (struct eth_device *dev, unsigned long data)
 {
-	*(volatile unsigned long *) ((TXBUFFER_START + dev->iobase)) = cpu_to_le32 (data);
+	writel(cpu_to_le32(data), TXBUFFER_START + (void *)dev->iobase);
 }
 #endif
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH v2] AX88180: use standard I/O accessors
  2010-06-03  1:03 ` [U-Boot] [PATCH v2] " Mike Frysinger
@ 2010-06-21  5:41   ` Ben Warren
  2010-06-21 17:25     ` Mike Frysinger
  0 siblings, 1 reply; 5+ messages in thread
From: Ben Warren @ 2010-06-21  5:41 UTC (permalink / raw)
  To: u-boot

Mike,

On 6/2/2010 6:03 PM, Mike Frysinger wrote:
> The current dm9000x driver accesses its memory mapped registers directly
> instead of using the standard I/O accessors.  This can cause problems on
> Blackfin systems as the accesses can get out of order.  So convert the
> direct volatile dereferences to use the normal in/out macros.
>
> Signed-off-by: Mike Frysinger<vapier@gentoo.org>
> Tested-by: Hoan Hoang<hnhoan@i-syst.com>
> ---
>    
I can't get this to apply.  Please rebase against TOT.

regards,
Ben

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH v2] AX88180: use standard I/O accessors
  2010-06-21  5:41   ` Ben Warren
@ 2010-06-21 17:25     ` Mike Frysinger
  2010-06-21 17:55       ` Ben Warren
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Frysinger @ 2010-06-21 17:25 UTC (permalink / raw)
  To: u-boot

On Monday, June 21, 2010 01:41:54 Ben Warren wrote:
> On 6/2/2010 6:03 PM, Mike Frysinger wrote:
> > The current dm9000x driver accesses its memory mapped registers directly
> > instead of using the standard I/O accessors.  This can cause problems on
> > Blackfin systems as the accesses can get out of order.  So convert the
> > direct volatile dereferences to use the normal in/out macros.
> > 
> > Signed-off-by: Mike Frysinger<vapier@gentoo.org>
> > Tested-by: Hoan Hoang<hnhoan@i-syst.com>
> > ---
> 
> I can't get this to apply.  Please rebase against TOT.

you need the first two in the series:
Applying: AX88180: add support for the Marvell 88E1118 phy
Applying: AX88180: make OUTW handle 32bit/16bit defines too
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100621/d1d87a54/attachment.pgp 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH v2] AX88180: use standard I/O accessors
  2010-06-21 17:25     ` Mike Frysinger
@ 2010-06-21 17:55       ` Ben Warren
  0 siblings, 0 replies; 5+ messages in thread
From: Ben Warren @ 2010-06-21 17:55 UTC (permalink / raw)
  To: u-boot

Hi Mike,

On 6/21/2010 10:25 AM, Mike Frysinger wrote:
> On Monday, June 21, 2010 01:41:54 Ben Warren wrote:
>    
>> On 6/2/2010 6:03 PM, Mike Frysinger wrote:
>>      
>>> The current dm9000x driver accesses its memory mapped registers directly
>>> instead of using the standard I/O accessors.  This can cause problems on
>>> Blackfin systems as the accesses can get out of order.  So convert the
>>> direct volatile dereferences to use the normal in/out macros.
>>>
>>> Signed-off-by: Mike Frysinger<vapier@gentoo.org>
>>> Tested-by: Hoan Hoang<hnhoan@i-syst.com>
>>> ---
>>>        
>> I can't get this to apply.  Please rebase against TOT.
>>      
> you need the first two in the series:
> Applying: AX88180: add support for the Marvell 88E1118 phy
> Applying: AX88180: make OUTW handle 32bit/16bit defines too
> -mike
>    
Sorry I missed those.  All three are now in net/text.

regards,
Ben

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-06-21 17:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-11  6:43 [U-Boot] [PATCH] AX88180: use standard I/O accessors Mike Frysinger
2010-06-03  1:03 ` [U-Boot] [PATCH v2] " Mike Frysinger
2010-06-21  5:41   ` Ben Warren
2010-06-21 17:25     ` Mike Frysinger
2010-06-21 17:55       ` Ben Warren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox