aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2011-07-13 05:27:29 -0400
committerDavid S. Miller <davem@davemloft.net>2011-07-14 11:41:59 -0400
commitbed9829f3ec4b30d5cbec6511a11368ba5f169fb (patch)
treee4c6d122e21cfe96d6645f171bfa558405f06a4b /drivers/net/tg3.c
parent168212858712b12c65e0fa1bec6c9c65808e7621 (diff)
tg3: Check transitions to D0 power state
Currently pci_set_power_state() does not return useful return codes for transitions to the D0 power state. If a device refuses to go into D0, the PCI layer issues a warning but returns success. Entering into D0 is a requirement for correct operation of tg3 devices though. If the PCI layer should be changed to return an error code for this type of failure, the tg3 driver would be interested in catching it and reacting to it. This patch makes the necessary modifications. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index ecbc10fed1a6..5d4283e7be7a 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -2657,14 +2657,19 @@ static void tg3_enable_register_access(struct tg3 *tp)
2657 2657
2658static int tg3_power_up(struct tg3 *tp) 2658static int tg3_power_up(struct tg3 *tp)
2659{ 2659{
2660 tg3_enable_register_access(tp); 2660 int err;
2661 2661
2662 pci_set_power_state(tp->pdev, PCI_D0); 2662 tg3_enable_register_access(tp);
2663 2663
2664 /* Switch out of Vaux if it is a NIC */ 2664 err = pci_set_power_state(tp->pdev, PCI_D0);
2665 tg3_pwrsrc_switch_to_vmain(tp); 2665 if (!err) {
2666 /* Switch out of Vaux if it is a NIC */
2667 tg3_pwrsrc_switch_to_vmain(tp);
2668 } else {
2669 netdev_err(tp->dev, "Transition to D0 failed\n");
2670 }
2666 2671
2667 return 0; 2672 return err;
2668} 2673}
2669 2674
2670static int tg3_power_down_prepare(struct tg3 *tp) 2675static int tg3_power_down_prepare(struct tg3 *tp)
@@ -11433,8 +11438,12 @@ static void tg3_self_test(struct net_device *dev, struct ethtool_test *etest,
11433{ 11438{
11434 struct tg3 *tp = netdev_priv(dev); 11439 struct tg3 *tp = netdev_priv(dev);
11435 11440
11436 if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) 11441 if ((tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) &&
11437 tg3_power_up(tp); 11442 tg3_power_up(tp)) {
11443 etest->flags |= ETH_TEST_FL_FAILED;
11444 memset(data, 1, sizeof(u64) * TG3_NUM_TEST);
11445 return;
11446 }
11438 11447
11439 memset(data, 0, sizeof(u64) * TG3_NUM_TEST); 11448 memset(data, 0, sizeof(u64) * TG3_NUM_TEST);
11440 11449
@@ -15571,10 +15580,8 @@ static pci_ers_result_t tg3_io_slot_reset(struct pci_dev *pdev)
15571 } 15580 }
15572 15581
15573 err = tg3_power_up(tp); 15582 err = tg3_power_up(tp);
15574 if (err) { 15583 if (err)
15575 netdev_err(netdev, "Failed to restore register access.\n");
15576 goto done; 15584 goto done;
15577 }
15578 15585
15579 rc = PCI_ERS_RESULT_RECOVERED; 15586 rc = PCI_ERS_RESULT_RECOVERED;
15580 15587