Skip to contentSkip to conversation

via-rhine: suspend/resume bugfix

PATCH In review Ondrej Zajicek 3 participants 5 messages Apr 27, 2008 – May 2, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 via-rhine: suspend/resume bugfix

There is a bug in via-rhine driver - the driver don't disable interrupts during suspend, which sometimes leads to globally disabled interrupt line.

This patch disables interrupts (and Rx/Tx) during suspend.

---

drivers/net/via-rhine.c +9 -0
diff -uprN -X linux-2.6.25/Documentation/dontdiff linux-2.6.25/drivers/net/via-rhine.c linux-2.6.25-feanor/drivers/net/via-rhine.c
@@ -1886,6 +1886,15 @@ static void rhine_shutdown (struct pci_d
 	struct rhine_private *rp = netdev_priv(dev);
 	void __iomem *ioaddr = rp->base;
 
+	/* Switch to loopback mode to avoid hardware races. */
+	iowrite8(rp->tx_thresh | 0x02, ioaddr + TxConfig);
+
+	/* Disable interrupts by clearing the interrupt mask. */
+	iowrite16(0x0000, ioaddr + IntrEnable);
+
+	/* Stop the chip's Tx and Rx processes. */
+	iowrite16(CmdStop, ioaddr + ChipCmd);
+
 	if (!(rp->quirks & rqWOL))
 		return; /* Nothing to do for non-WOL adapters */
 
#1 lore raw
Quoted 18 lines · Ondrej Zajicek

There is a bug in via-rhine driver - the driver don't disable interrupts during suspend, which sometimes leads to globally disabled interrupt line.

This patch disables interrupts (and Rx/Tx) during suspend.

---

diff -uprN -X linux-2.6.25/Documentation/dontdiff linux-2.6.25/drivers/net/via-rhine.c linux-2.6.25-feanor/drivers/net/via-rhine.c

drivers/net/via-rhine.c +1 -0
@@ -1886,6 +1886,15 @@ static void rhine_shutdown (struct pci_d
 	struct rhine_private *rp = netdev_priv(dev);
 	void __iomem *ioaddr = rp->base;
 
+	/* Switch to loopback mode to avoid hardware races. */

drivers/net/via-rhine.c static void rhine_shutdown (struct pci_d · line 1899

Quoted 10 lines
drivers/net/via-rhine.c +8 -0
+	iowrite8(rp->tx_thresh | 0x02, ioaddr + TxConfig);
+
+	/* Disable interrupts by clearing the interrupt mask. */
+	iowrite16(0x0000, ioaddr + IntrEnable);
+
+	/* Stop the chip's Tx and Rx processes. */
+	iowrite16(CmdStop, ioaddr + ChipCmd);
+
 	if (!(rp->quirks & rqWOL))
 		return; /* Nothing to do for non-WOL adapters */

What about PCI posting?

#2 lore raw
Quoted 7 lines · Jiri Slaby

drivers/net/via-rhine.c static void rhine_shutdown (struct pci_d · line 1896

Quoted 5 lines
drivers/net/via-rhine.c +5 -0
+	/* Disable interrupts by clearing the interrupt mask. */
+	iowrite16(0x0000, ioaddr + IntrEnable);
+
+	/* Stop the chip's Tx and Rx processes. */
+	iowrite16(CmdStop, ioaddr + ChipCmd);

What about PCI posting?

Hmm, i will fix it. And i found that the patch might break wakeup-on-LAN. So please discard it.

Signature · 5 lines
Elen sila lumenn' omentielvo

Ondrej 'SanTiago' Zajicek (email: [email protected])
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."
#3 lore raw
Quoted 11 lines · Ondrej Zajicek
Quoted 7 lines · Jiri Slaby

drivers/net/via-rhine.c static void rhine_shutdown (struct pci_d · line 1896

Quoted 5 lines
drivers/net/via-rhine.c +5 -0
+	/* Disable interrupts by clearing the interrupt mask. */
+	iowrite16(0x0000, ioaddr + IntrEnable);
+
+	/* Stop the chip's Tx and Rx processes. */
+	iowrite16(CmdStop, ioaddr + ChipCmd);

What about PCI posting?

Hmm, i will fix it. And i found that the patch might break wakeup-on-LAN. So please discard it.

IRQ line should not be neccessary for WoL...?

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#4 lore raw
Quoted 4 lines · Pavel Machek
Quoted 2 lines

Hmm, i will fix it. And i found that the patch might break wakeup-on-LAN. So please discard it.

IRQ line should not be neccessary for WoL...?

IRQ line is not neccessary (i hope), but the patch puts this to suspend path:

/* Switch to loopback mode to avoid hardware races. */ iowrite8(rp->tx_thresh | 0x02, ioaddr + TxConfig);

/* Disable interrupts by clearing the interrupt mask. */ iowrite16(0x0000, ioaddr + IntrEnable);

/* Stop the chip's Tx and Rx processes. */
iowrite16(CmdStop, ioaddr + ChipCmd);

(this was copied from shutdown path of the driver)

I suppose that the first one might break WoL. Unfortunately on my hardware the WoL don't work even without the patch.

Signature · 5 lines
Elen sila lumenn' omentielvo

Ondrej 'SanTiago' Zajicek (email: [email protected])
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."