diff options
Diffstat (limited to 'drivers/net/atl1c/atl1c_main.c')
-rw-r--r-- | drivers/net/atl1c/atl1c_main.c | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/drivers/net/atl1c/atl1c_main.c b/drivers/net/atl1c/atl1c_main.c index 09b099bfab2b..bdf11d89a499 100644 --- a/drivers/net/atl1c/atl1c_main.c +++ b/drivers/net/atl1c/atl1c_main.c | |||
@@ -702,6 +702,7 @@ static int __devinit atl1c_sw_init(struct atl1c_adapter *adapter) | |||
702 | 702 | ||
703 | 703 | ||
704 | adapter->wol = 0; | 704 | adapter->wol = 0; |
705 | device_set_wakeup_enable(&pdev->dev, false); | ||
705 | adapter->link_speed = SPEED_0; | 706 | adapter->link_speed = SPEED_0; |
706 | adapter->link_duplex = FULL_DUPLEX; | 707 | adapter->link_duplex = FULL_DUPLEX; |
707 | adapter->num_rx_queues = AT_DEF_RECEIVE_QUEUE; | 708 | adapter->num_rx_queues = AT_DEF_RECEIVE_QUEUE; |
@@ -2444,8 +2445,9 @@ static int atl1c_close(struct net_device *netdev) | |||
2444 | return 0; | 2445 | return 0; |
2445 | } | 2446 | } |
2446 | 2447 | ||
2447 | static int atl1c_suspend(struct pci_dev *pdev, pm_message_t state) | 2448 | static int atl1c_suspend(struct device *dev) |
2448 | { | 2449 | { |
2450 | struct pci_dev *pdev = to_pci_dev(dev); | ||
2449 | struct net_device *netdev = pci_get_drvdata(pdev); | 2451 | struct net_device *netdev = pci_get_drvdata(pdev); |
2450 | struct atl1c_adapter *adapter = netdev_priv(netdev); | 2452 | struct atl1c_adapter *adapter = netdev_priv(netdev); |
2451 | struct atl1c_hw *hw = &adapter->hw; | 2453 | struct atl1c_hw *hw = &adapter->hw; |
@@ -2454,7 +2456,6 @@ static int atl1c_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2454 | u32 wol_ctrl_data = 0; | 2456 | u32 wol_ctrl_data = 0; |
2455 | u16 mii_intr_status_data = 0; | 2457 | u16 mii_intr_status_data = 0; |
2456 | u32 wufc = adapter->wol; | 2458 | u32 wufc = adapter->wol; |
2457 | int retval = 0; | ||
2458 | 2459 | ||
2459 | atl1c_disable_l0s_l1(hw); | 2460 | atl1c_disable_l0s_l1(hw); |
2460 | if (netif_running(netdev)) { | 2461 | if (netif_running(netdev)) { |
@@ -2462,9 +2463,6 @@ static int atl1c_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2462 | atl1c_down(adapter); | 2463 | atl1c_down(adapter); |
2463 | } | 2464 | } |
2464 | netif_device_detach(netdev); | 2465 | netif_device_detach(netdev); |
2465 | retval = pci_save_state(pdev); | ||
2466 | if (retval) | ||
2467 | return retval; | ||
2468 | 2466 | ||
2469 | if (wufc) | 2467 | if (wufc) |
2470 | if (atl1c_phy_power_saving(hw) != 0) | 2468 | if (atl1c_phy_power_saving(hw) != 0) |
@@ -2525,12 +2523,8 @@ static int atl1c_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2525 | AT_WRITE_REG(hw, REG_WOL_CTRL, wol_ctrl_data); | 2523 | AT_WRITE_REG(hw, REG_WOL_CTRL, wol_ctrl_data); |
2526 | AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data); | 2524 | AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data); |
2527 | 2525 | ||
2528 | /* pcie patch */ | ||
2529 | device_set_wakeup_enable(&pdev->dev, 1); | ||
2530 | |||
2531 | AT_WRITE_REG(hw, REG_GPHY_CTRL, GPHY_CTRL_DEFAULT | | 2526 | AT_WRITE_REG(hw, REG_GPHY_CTRL, GPHY_CTRL_DEFAULT | |
2532 | GPHY_CTRL_EXT_RESET); | 2527 | GPHY_CTRL_EXT_RESET); |
2533 | pci_prepare_to_sleep(pdev); | ||
2534 | } else { | 2528 | } else { |
2535 | AT_WRITE_REG(hw, REG_GPHY_CTRL, GPHY_CTRL_POWER_SAVING); | 2529 | AT_WRITE_REG(hw, REG_GPHY_CTRL, GPHY_CTRL_POWER_SAVING); |
2536 | master_ctrl_data |= MASTER_CTRL_CLK_SEL_DIS; | 2530 | master_ctrl_data |= MASTER_CTRL_CLK_SEL_DIS; |
@@ -2540,25 +2534,17 @@ static int atl1c_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2540 | AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data); | 2534 | AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data); |
2541 | AT_WRITE_REG(hw, REG_WOL_CTRL, 0); | 2535 | AT_WRITE_REG(hw, REG_WOL_CTRL, 0); |
2542 | hw->phy_configured = false; /* re-init PHY when resume */ | 2536 | hw->phy_configured = false; /* re-init PHY when resume */ |
2543 | pci_enable_wake(pdev, pci_choose_state(pdev, state), 0); | ||
2544 | } | 2537 | } |
2545 | 2538 | ||
2546 | pci_disable_device(pdev); | ||
2547 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | ||
2548 | |||
2549 | return 0; | 2539 | return 0; |
2550 | } | 2540 | } |
2551 | 2541 | ||
2552 | static int atl1c_resume(struct pci_dev *pdev) | 2542 | static int atl1c_resume(struct device *dev) |
2553 | { | 2543 | { |
2544 | struct pci_dev *pdev = to_pci_dev(dev); | ||
2554 | struct net_device *netdev = pci_get_drvdata(pdev); | 2545 | struct net_device *netdev = pci_get_drvdata(pdev); |
2555 | struct atl1c_adapter *adapter = netdev_priv(netdev); | 2546 | struct atl1c_adapter *adapter = netdev_priv(netdev); |
2556 | 2547 | ||
2557 | pci_set_power_state(pdev, PCI_D0); | ||
2558 | pci_restore_state(pdev); | ||
2559 | pci_enable_wake(pdev, PCI_D3hot, 0); | ||
2560 | pci_enable_wake(pdev, PCI_D3cold, 0); | ||
2561 | |||
2562 | AT_WRITE_REG(&adapter->hw, REG_WOL_CTRL, 0); | 2548 | AT_WRITE_REG(&adapter->hw, REG_WOL_CTRL, 0); |
2563 | atl1c_reset_pcie(&adapter->hw, ATL1C_PCIE_L0S_L1_DISABLE | | 2549 | atl1c_reset_pcie(&adapter->hw, ATL1C_PCIE_L0S_L1_DISABLE | |
2564 | ATL1C_PCIE_PHY_RESET); | 2550 | ATL1C_PCIE_PHY_RESET); |
@@ -2582,7 +2568,12 @@ static int atl1c_resume(struct pci_dev *pdev) | |||
2582 | 2568 | ||
2583 | static void atl1c_shutdown(struct pci_dev *pdev) | 2569 | static void atl1c_shutdown(struct pci_dev *pdev) |
2584 | { | 2570 | { |
2585 | atl1c_suspend(pdev, PMSG_SUSPEND); | 2571 | struct net_device *netdev = pci_get_drvdata(pdev); |
2572 | struct atl1c_adapter *adapter = netdev_priv(netdev); | ||
2573 | |||
2574 | atl1c_suspend(&pdev->dev); | ||
2575 | pci_wake_from_d3(pdev, adapter->wol); | ||
2576 | pci_set_power_state(pdev, PCI_D3hot); | ||
2586 | } | 2577 | } |
2587 | 2578 | ||
2588 | static const struct net_device_ops atl1c_netdev_ops = { | 2579 | static const struct net_device_ops atl1c_netdev_ops = { |
@@ -2886,16 +2877,16 @@ static struct pci_error_handlers atl1c_err_handler = { | |||
2886 | .resume = atl1c_io_resume, | 2877 | .resume = atl1c_io_resume, |
2887 | }; | 2878 | }; |
2888 | 2879 | ||
2880 | static SIMPLE_DEV_PM_OPS(atl1c_pm_ops, atl1c_suspend, atl1c_resume); | ||
2881 | |||
2889 | static struct pci_driver atl1c_driver = { | 2882 | static struct pci_driver atl1c_driver = { |
2890 | .name = atl1c_driver_name, | 2883 | .name = atl1c_driver_name, |
2891 | .id_table = atl1c_pci_tbl, | 2884 | .id_table = atl1c_pci_tbl, |
2892 | .probe = atl1c_probe, | 2885 | .probe = atl1c_probe, |
2893 | .remove = __devexit_p(atl1c_remove), | 2886 | .remove = __devexit_p(atl1c_remove), |
2894 | /* Power Managment Hooks */ | ||
2895 | .suspend = atl1c_suspend, | ||
2896 | .resume = atl1c_resume, | ||
2897 | .shutdown = atl1c_shutdown, | 2887 | .shutdown = atl1c_shutdown, |
2898 | .err_handler = &atl1c_err_handler | 2888 | .err_handler = &atl1c_err_handler, |
2889 | .driver.pm = &atl1c_pm_ops, | ||
2899 | }; | 2890 | }; |
2900 | 2891 | ||
2901 | /* | 2892 | /* |