aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/broadcom/bnx2.c
diff options
context:
space:
mode:
authorMichael Chan <mchan@broadcom.com>2013-08-06 18:50:08 -0400
committerDavid S. Miller <davem@davemloft.net>2013-08-07 13:44:05 -0400
commit6d5e85c71bf02fa10b0ea716776a71619b677f87 (patch)
tree6c80b4a99a85209de1f5803739ce82da0092a08b /drivers/net/ethernet/broadcom/bnx2.c
parent02481bc678076f05643e7b240b2ea7c9aa1e72e1 (diff)
bnx2: Use kernel APIs for WoL and power state changes.
Simple API changes with no functional changes. Signed-off-by: Michael Chan <mchan@broadocm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/bnx2.c')
-rw-r--r--drivers/net/ethernet/broadcom/bnx2.c36
1 files changed, 14 insertions, 22 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c
index 3baf8b5631f9..ac72f80287eb 100644
--- a/drivers/net/ethernet/broadcom/bnx2.c
+++ b/drivers/net/ethernet/broadcom/bnx2.c
@@ -3911,21 +3911,12 @@ init_cpu_err:
3911static int 3911static int
3912bnx2_set_power_state(struct bnx2 *bp, pci_power_t state) 3912bnx2_set_power_state(struct bnx2 *bp, pci_power_t state)
3913{ 3913{
3914 u16 pmcsr;
3915
3916 pci_read_config_word(bp->pdev, bp->pm_cap + PCI_PM_CTRL, &pmcsr);
3917
3918 switch (state) { 3914 switch (state) {
3919 case PCI_D0: { 3915 case PCI_D0: {
3920 u32 val; 3916 u32 val;
3921 3917
3922 pci_write_config_word(bp->pdev, bp->pm_cap + PCI_PM_CTRL, 3918 pci_enable_wake(bp->pdev, PCI_D0, false);
3923 (pmcsr & ~PCI_PM_CTRL_STATE_MASK) | 3919 pci_set_power_state(bp->pdev, PCI_D0);
3924 PCI_PM_CTRL_PME_STATUS);
3925
3926 if (pmcsr & PCI_PM_CTRL_STATE_MASK)
3927 /* delay required during transition out of D3hot */
3928 msleep(20);
3929 3920
3930 val = BNX2_RD(bp, BNX2_EMAC_MODE); 3921 val = BNX2_RD(bp, BNX2_EMAC_MODE);
3931 val |= BNX2_EMAC_MODE_MPKT_RCVD | BNX2_EMAC_MODE_ACPI_RCVD; 3922 val |= BNX2_EMAC_MODE_MPKT_RCVD | BNX2_EMAC_MODE_ACPI_RCVD;
@@ -4018,26 +4009,19 @@ bnx2_set_power_state(struct bnx2 *bp, pci_power_t state)
4018 bnx2_fw_sync(bp, BNX2_DRV_MSG_DATA_WAIT3 | wol_msg, 4009 bnx2_fw_sync(bp, BNX2_DRV_MSG_DATA_WAIT3 | wol_msg,
4019 1, 0); 4010 1, 0);
4020 4011
4021 pmcsr &= ~PCI_PM_CTRL_STATE_MASK; 4012 pci_wake_from_d3(bp->pdev, bp->wol);
4022 if ((BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A0) || 4013 if ((BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A0) ||
4023 (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A1)) { 4014 (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A1)) {
4024 4015
4025 if (bp->wol) 4016 if (bp->wol)
4026 pmcsr |= 3; 4017 pci_set_power_state(bp->pdev, PCI_D3hot);
4027 } 4018 } else {
4028 else { 4019 pci_set_power_state(bp->pdev, PCI_D3hot);
4029 pmcsr |= 3;
4030 }
4031 if (bp->wol) {
4032 pmcsr |= PCI_PM_CTRL_PME_ENABLE;
4033 } 4020 }
4034 pci_write_config_word(bp->pdev, bp->pm_cap + PCI_PM_CTRL,
4035 pmcsr);
4036 4021
4037 /* No more memory access after this point until 4022 /* No more memory access after this point until
4038 * device is brought back to D0. 4023 * device is brought back to D0.
4039 */ 4024 */
4040 udelay(50);
4041 break; 4025 break;
4042 } 4026 }
4043 default: 4027 default:
@@ -7081,6 +7065,9 @@ bnx2_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
7081 else { 7065 else {
7082 bp->wol = 0; 7066 bp->wol = 0;
7083 } 7067 }
7068
7069 device_set_wakeup_enable(&bp->pdev->dev, bp->wol);
7070
7084 return 0; 7071 return 0;
7085} 7072}
7086 7073
@@ -8369,6 +8356,11 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
8369 bp->wol = 0; 8356 bp->wol = 0;
8370 } 8357 }
8371 8358
8359 if (bp->flags & BNX2_FLAG_NO_WOL)
8360 device_set_wakeup_capable(&bp->pdev->dev, false);
8361 else
8362 device_set_wakeup_enable(&bp->pdev->dev, bp->wol);
8363
8372 if (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A0) { 8364 if (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A0) {
8373 bp->tx_quick_cons_trip_int = 8365 bp->tx_quick_cons_trip_int =
8374 bp->tx_quick_cons_trip; 8366 bp->tx_quick_cons_trip;