* Patch: working suspend/resume for xircom_tulip_cb
@ 2004-02-15 14:02 Stefan Rompf
0 siblings, 0 replies; only message in thread
From: Stefan Rompf @ 2004-02-15 14:02 UTC (permalink / raw)
To: netdev; +Cc: jgarzik, ionut
[-- Attachment #1: Type: text/plain, Size: 459 bytes --]
Hi,
attached is a patch against 2.6.3rc2 that fixes suspend/resume for the
ethernet device of my Xircom RBEM56G-100 pc card. Previously, the driver did
not survive the resume operation. I still have problems when I remove the
card during suspend, but that yields to a different code path.
I could check with one laptop and one card, so the patch might need broader
testing, but it works nicely in my configuration.
Please apply if it looks ok.
Stefan
[-- Attachment #2: xircom_tulip_cb_pm.diff --]
[-- Type: text/x-diff, Size: 1503 bytes --]
--- drivers/net/tulip/xircom_tulip_cb.c.old 2004-02-14 14:33:03.000000000 +0100
+++ drivers/net/tulip/xircom_tulip_cb.c 2004-02-15 13:07:49.000000000 +0100
@@ -329,6 +329,9 @@ struct xircom_private {
int saved_if_port;
struct pci_dev *pdev;
spinlock_t lock;
+#ifdef CONFIG_PM
+ u32 pci_state[16];
+#endif
};
static int mdio_read(struct net_device *dev, int phy_id, int location);
@@ -749,6 +752,7 @@ xircom_up(struct net_device *dev)
long ioaddr = dev->base_addr;
int i;
+ xircom_init_ring(dev);
/* Clear the tx ring */
for (i = 0; i < TX_RING_SIZE; i++) {
tp->tx_skbuff[i] = 0;
@@ -801,8 +805,6 @@ xircom_open(struct net_device *dev)
if (request_irq(dev->irq, &xircom_interrupt, SA_SHIRQ, dev->name, dev))
return -EAGAIN;
- xircom_init_ring(dev);
-
xircom_up(dev);
tp->open = 1;
@@ -1668,6 +1670,11 @@ static int xircom_suspend(struct pci_dev
printk(KERN_INFO "xircom_suspend(%s)\n", dev->name);
if (tp->open)
xircom_down(dev);
+
+ pci_save_state(pdev, tp->pci_state);
+ pci_disable_device(pdev);
+ pci_set_power_state(pdev, 3);
+
return 0;
}
@@ -1678,6 +1685,10 @@ static int xircom_resume(struct pci_dev
struct xircom_private *tp = dev->priv;
printk(KERN_INFO "xircom_resume(%s)\n", dev->name);
+ pci_set_power_state(pdev,0);
+ pci_enable_device(pdev);
+ pci_restore_state(pdev, tp->pci_state);
+
/* Bring the chip out of sleep mode.
Caution: Snooze mode does not work with some boards! */
if (xircom_tbl[tp->chip_id].flags & HAS_ACPI)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-02-15 14:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-15 14:02 Patch: working suspend/resume for xircom_tulip_cb Stefan Rompf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).