Skip to contentSkip to conversation

net: pcnet: fix I/O primitives for memory access

PATCH New Daniel Schwierzeck 2 participants 2 messages May 3, 2020 – May 4, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: pcnet: fix I/O primitives for memory access

Commit 69529c912059 ("net: pcnet: Switch to PCI memory access") switched from PCI IO access to PCI memory access without updating the I/O primitives. Contrary to SH, the primitives for memory access and IO access are implemented differently. Thus doing memory access with IO port primitives breaks the driver on MIPS Malta board.

---
Needs to be applied after

[PULL] u-boot-sh/next network cleanup part 1

https://patchwork.ozlabs.org/project/uboot/patch/270da1a6-aa7a-16c6-6642-76a9ea8a7048 at denx.de/

 drivers/net/pcnet.c | 34 +++++++++++++++++++++++-----------
 1 file changed, 23 insertions(+), 11 deletions(-)
drivers/net/pcnet.c +23 -11
index df82b716a7..8dfcb10a15 100644
@@ -95,37 +95,49 @@ static pcnet_priv_t *lp;
 
 static u16 pcnet_read_csr(struct eth_device *dev, int index)
 {
-	outw(index, dev->iobase + PCNET_RAP);
-	return inw(dev->iobase + PCNET_RDP);
+	void __iomem *base = (void __iomem *)dev->iobase;
+
+	writew(index, base + PCNET_RAP);
+	return readw(base + PCNET_RDP);
 }
 
 static void pcnet_write_csr(struct eth_device *dev, int index, u16 val)
 {
-	outw(index, dev->iobase + PCNET_RAP);
-	outw(val, dev->iobase + PCNET_RDP);
+	void __iomem *base = (void __iomem *)dev->iobase;
+
+	writew(index, base + PCNET_RAP);
+	writew(val, base + PCNET_RDP);
 }
 
 static u16 pcnet_read_bcr(struct eth_device *dev, int index)
 {
-	outw(index, dev->iobase + PCNET_RAP);
-	return inw(dev->iobase + PCNET_BDP);
+	void __iomem *base = (void __iomem *)dev->iobase;
+
+	writew(index, base + PCNET_RAP);
+	return readw(base + PCNET_BDP);
 }
 
 static void pcnet_write_bcr(struct eth_device *dev, int index, u16 val)
 {
-	outw(index, dev->iobase + PCNET_RAP);
-	outw(val, dev->iobase + PCNET_BDP);
+	void __iomem *base = (void __iomem *)dev->iobase;
+
+	writew(index, base + PCNET_RAP);
+	writew(val, base + PCNET_BDP);
 }
 
 static void pcnet_reset(struct eth_device *dev)
 {
-	inw(dev->iobase + PCNET_RESET);
+	void __iomem *base = (void __iomem *)dev->iobase;
+
+	readw(base + PCNET_RESET);
 }
 
 static int pcnet_check(struct eth_device *dev)
 {
-	outw(88, dev->iobase + PCNET_RAP);
-	return inw(dev->iobase + PCNET_RAP) == 88;
+	void __iomem *base = (void __iomem *)dev->iobase;
+
+	writew(88, base + PCNET_RAP);
+	return readw(base + PCNET_RAP) == 88;
 }
 
 static int pcnet_init (struct eth_device *dev, bd_t * bis);
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/1 net: pcnet: fix I/O primitives for memory access

Quoted 9 lines · Daniel Schwierzeck

Commit 69529c912059 ("net: pcnet: Switch to PCI memory access") switched from PCI IO access to PCI memory access without updating the I/O primitives. Contrary to SH, the primitives for memory access and IO access are implemented differently. Thus doing memory access with IO port primitives breaks the driver on MIPS Malta board.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200504/0e8e7e29/attachment.sig>