2 Power management interface routines.
3 Written by Mariusz Matuszek.
4 This code is currently just a placeholder for later work and
5 does not do anything useful.
7 This is part of rtl8180 OpenSource driver.
8 Copyright (C) Andrea Merello 2004 <andreamrl@tiscali.it>
9 Released under the terms of GPL (General Public Licence)
18 int rtl8180_suspend(struct pci_dev *pdev, pm_message_t state)
20 struct net_device *dev = pci_get_drvdata(pdev);
22 if (!netif_running(dev))
25 if (dev->netdev_ops->ndo_stop)
26 dev->netdev_ops->ndo_stop(dev);
28 netif_device_detach(dev);
32 pci_disable_device(pdev);
33 pci_set_power_state(pdev, pci_choose_state(pdev, state));
37 int rtl8180_resume(struct pci_dev *pdev)
39 struct net_device *dev = pci_get_drvdata(pdev);
43 pci_set_power_state(pdev, PCI_D0);
45 err = pci_enable_device(pdev);
47 printk(KERN_ERR "%s: pci_enable_device failed on resume\n",
53 pci_restore_state(pdev);
56 * Suspend/Resume resets the PCI configuration space, so we have to
57 * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries
58 * from interfering with C3 CPU state. pci_restore_state won't help
59 * here since it only restores the first 64 bytes pci config header.
61 pci_read_config_dword(pdev, 0x40, &val);
62 if ((val & 0x0000ff00) != 0)
63 pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
65 if (!netif_running(dev))
68 if (dev->netdev_ops->ndo_open)
69 dev->netdev_ops->ndo_open(dev);
71 netif_device_attach(dev);