diff options
author | Michael Chan <mchan@broadcom.com> | 2007-08-03 23:56:54 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-08-03 23:56:54 -0400 |
commit | 3e0c95fd648c0d3175b9ff2232597d0b02eb7d46 (patch) | |
tree | 4678031803e9848c5ff282e66ebcd3c6474ae144 /drivers/net/tg3.c | |
parent | d4ac2477fad0f2680e84ec12e387ce67682c5c13 (diff) |
[TG3]: Fix suspend/resume problem.
Joachim Deguara <joachim.deguara@amd.com> reported that tg3 devices
would not resume properly if the device was shutdown before the system
was suspended. In such scenario where the netif_running state is 0,
tg3_suspend() would not save the PCI state and so the memory enable bit
and bus master enable bit would be lost.
We fix this by always saving and restoring the PCI state in
tg3_suspend() and tg3_resume() regardless of netif_running() state.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r-- | drivers/net/tg3.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index dc41c055ebb5..58740428dd07 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -64,8 +64,8 @@ | |||
64 | 64 | ||
65 | #define DRV_MODULE_NAME "tg3" | 65 | #define DRV_MODULE_NAME "tg3" |
66 | #define PFX DRV_MODULE_NAME ": " | 66 | #define PFX DRV_MODULE_NAME ": " |
67 | #define DRV_MODULE_VERSION "3.79" | 67 | #define DRV_MODULE_VERSION "3.80" |
68 | #define DRV_MODULE_RELDATE "July 18, 2007" | 68 | #define DRV_MODULE_RELDATE "August 2, 2007" |
69 | 69 | ||
70 | #define TG3_DEF_MAC_MODE 0 | 70 | #define TG3_DEF_MAC_MODE 0 |
71 | #define TG3_DEF_RX_MODE 0 | 71 | #define TG3_DEF_RX_MODE 0 |
@@ -12111,6 +12111,12 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state) | |||
12111 | struct tg3 *tp = netdev_priv(dev); | 12111 | struct tg3 *tp = netdev_priv(dev); |
12112 | int err; | 12112 | int err; |
12113 | 12113 | ||
12114 | /* PCI register 4 needs to be saved whether netif_running() or not. | ||
12115 | * MSI address and data need to be saved if using MSI and | ||
12116 | * netif_running(). | ||
12117 | */ | ||
12118 | pci_save_state(pdev); | ||
12119 | |||
12114 | if (!netif_running(dev)) | 12120 | if (!netif_running(dev)) |
12115 | return 0; | 12121 | return 0; |
12116 | 12122 | ||
@@ -12130,9 +12136,6 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state) | |||
12130 | tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE; | 12136 | tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE; |
12131 | tg3_full_unlock(tp); | 12137 | tg3_full_unlock(tp); |
12132 | 12138 | ||
12133 | /* Save MSI address and data for resume. */ | ||
12134 | pci_save_state(pdev); | ||
12135 | |||
12136 | err = tg3_set_power_state(tp, pci_choose_state(pdev, state)); | 12139 | err = tg3_set_power_state(tp, pci_choose_state(pdev, state)); |
12137 | if (err) { | 12140 | if (err) { |
12138 | tg3_full_lock(tp, 0); | 12141 | tg3_full_lock(tp, 0); |
@@ -12160,11 +12163,11 @@ static int tg3_resume(struct pci_dev *pdev) | |||
12160 | struct tg3 *tp = netdev_priv(dev); | 12163 | struct tg3 *tp = netdev_priv(dev); |
12161 | int err; | 12164 | int err; |
12162 | 12165 | ||
12166 | pci_restore_state(tp->pdev); | ||
12167 | |||
12163 | if (!netif_running(dev)) | 12168 | if (!netif_running(dev)) |
12164 | return 0; | 12169 | return 0; |
12165 | 12170 | ||
12166 | pci_restore_state(tp->pdev); | ||
12167 | |||
12168 | err = tg3_set_power_state(tp, PCI_D0); | 12171 | err = tg3_set_power_state(tp, PCI_D0); |
12169 | if (err) | 12172 | if (err) |
12170 | return err; | 12173 | return err; |