diff options
author | Maxim Levitsky <maximlevitsky@gmail.com> | 2007-03-06 05:41:53 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-04-28 11:00:57 -0400 |
commit | bc8a8387ba57db2275e717c19838a8d5a404c270 (patch) | |
tree | 85ab2d2d2b5786f006c5062b46015faaebc746a7 /drivers/net/tulip/dmfe.c | |
parent | b3df0da886ffdb3e70c3197f589e959e5f8c9c04 (diff) |
dmfe: add support for suspend/resume
This adds support for suspend resume
[akpm@linux-foundation.org: fix CONFIG_PM=n, coding style]
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Cc: Valerie Henson <val_henson@linux.intel.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/tulip/dmfe.c')
-rw-r--r-- | drivers/net/tulip/dmfe.c | 52 |
1 files changed, 49 insertions, 3 deletions
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c index b3a64ca98634..e3a077977e4c 100644 --- a/drivers/net/tulip/dmfe.c +++ b/drivers/net/tulip/dmfe.c | |||
@@ -55,9 +55,6 @@ | |||
55 | 55 | ||
56 | TODO | 56 | TODO |
57 | 57 | ||
58 | Implement pci_driver::suspend() and pci_driver::resume() | ||
59 | power management methods. | ||
60 | |||
61 | Check on 64 bit boxes. | 58 | Check on 64 bit boxes. |
62 | Check and fix on big endian boxes. | 59 | Check and fix on big endian boxes. |
63 | 60 | ||
@@ -2050,11 +2047,60 @@ static struct pci_device_id dmfe_pci_tbl[] = { | |||
2050 | MODULE_DEVICE_TABLE(pci, dmfe_pci_tbl); | 2047 | MODULE_DEVICE_TABLE(pci, dmfe_pci_tbl); |
2051 | 2048 | ||
2052 | 2049 | ||
2050 | #ifdef CONFIG_PM | ||
2051 | static int dmfe_suspend(struct pci_dev *pci_dev, pm_message_t state) | ||
2052 | { | ||
2053 | struct net_device *dev = pci_get_drvdata(pci_dev); | ||
2054 | struct dmfe_board_info *db = netdev_priv(dev); | ||
2055 | |||
2056 | /* Disable upper layer interface */ | ||
2057 | netif_device_detach(dev); | ||
2058 | |||
2059 | /* Disable Tx/Rx */ | ||
2060 | db->cr6_data &= ~(CR6_RXSC | CR6_TXSC); | ||
2061 | update_cr6(db->cr6_data, dev->base_addr); | ||
2062 | |||
2063 | /* Disable Interrupt */ | ||
2064 | outl(0, dev->base_addr + DCR7); | ||
2065 | outl(inl (dev->base_addr + DCR5), dev->base_addr + DCR5); | ||
2066 | |||
2067 | /* Fre RX buffers */ | ||
2068 | dmfe_free_rxbuffer(db); | ||
2069 | |||
2070 | /* Power down device*/ | ||
2071 | pci_set_power_state(pci_dev, pci_choose_state (pci_dev,state)); | ||
2072 | pci_save_state(pci_dev); | ||
2073 | |||
2074 | return 0; | ||
2075 | } | ||
2076 | |||
2077 | static int dmfe_resume(struct pci_dev *pci_dev) | ||
2078 | { | ||
2079 | struct net_device *dev = pci_get_drvdata(pci_dev); | ||
2080 | |||
2081 | pci_restore_state(pci_dev); | ||
2082 | pci_set_power_state(pci_dev, PCI_D0); | ||
2083 | |||
2084 | /* Re-initilize DM910X board */ | ||
2085 | dmfe_init_dm910x(dev); | ||
2086 | |||
2087 | /* Restart upper layer interface */ | ||
2088 | netif_device_attach(dev); | ||
2089 | |||
2090 | return 0; | ||
2091 | } | ||
2092 | #else | ||
2093 | #define dmfe_suspend NULL | ||
2094 | #define dmfe_resume NULL | ||
2095 | #endif | ||
2096 | |||
2053 | static struct pci_driver dmfe_driver = { | 2097 | static struct pci_driver dmfe_driver = { |
2054 | .name = "dmfe", | 2098 | .name = "dmfe", |
2055 | .id_table = dmfe_pci_tbl, | 2099 | .id_table = dmfe_pci_tbl, |
2056 | .probe = dmfe_init_one, | 2100 | .probe = dmfe_init_one, |
2057 | .remove = __devexit_p(dmfe_remove_one), | 2101 | .remove = __devexit_p(dmfe_remove_one), |
2102 | .suspend = dmfe_suspend, | ||
2103 | .resume = dmfe_resume | ||
2058 | }; | 2104 | }; |
2059 | 2105 | ||
2060 | MODULE_AUTHOR("Sten Wang, sten_wang@davicom.com.tw"); | 2106 | MODULE_AUTHOR("Sten Wang, sten_wang@davicom.com.tw"); |