diff options
author | stephen hemminger <shemminger@vyatta.com> | 2011-04-04 11:06:36 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-06 14:35:21 -0700 |
commit | 2e17e1aa80e914acd8a31a41b9bf1173186a976a (patch) | |
tree | a3a5f0969aefd30dc2c210c53ccfcb8f807ea89b /drivers/net | |
parent | 6d8a7e6f52b0bf646739f2d4bad4643c64977b2a (diff) | |
download | linux-2e17e1aa80e914acd8a31a41b9bf1173186a976a.tar.bz2 |
bnx2: convert to set_phys_id
In this case, need to add element to device private to hold
original led state.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/bnx2.c | 56 | ||||
-rw-r--r-- | drivers/net/bnx2.h | 1 |
2 files changed, 28 insertions, 29 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 8e6d618b5305..05ddfb18d5bf 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c @@ -7495,41 +7495,39 @@ bnx2_get_ethtool_stats(struct net_device *dev, } static int -bnx2_phys_id(struct net_device *dev, u32 data) +bnx2_set_phys_id(struct net_device *dev, enum ethtool_phys_id_state state) { struct bnx2 *bp = netdev_priv(dev); - int i; - u32 save; - bnx2_set_power_state(bp, PCI_D0); + switch (state) { + case ETHTOOL_ID_ACTIVE: + bnx2_set_power_state(bp, PCI_D0); - if (data == 0) - data = 2; + bp->leds_save = REG_RD(bp, BNX2_MISC_CFG); + REG_WR(bp, BNX2_MISC_CFG, BNX2_MISC_CFG_LEDMODE_MAC); + return -EINVAL; - save = REG_RD(bp, BNX2_MISC_CFG); - REG_WR(bp, BNX2_MISC_CFG, BNX2_MISC_CFG_LEDMODE_MAC); + case ETHTOOL_ID_ON: + REG_WR(bp, BNX2_EMAC_LED, BNX2_EMAC_LED_OVERRIDE | + BNX2_EMAC_LED_1000MB_OVERRIDE | + BNX2_EMAC_LED_100MB_OVERRIDE | + BNX2_EMAC_LED_10MB_OVERRIDE | + BNX2_EMAC_LED_TRAFFIC_OVERRIDE | + BNX2_EMAC_LED_TRAFFIC); + break; - for (i = 0; i < (data * 2); i++) { - if ((i % 2) == 0) { - REG_WR(bp, BNX2_EMAC_LED, BNX2_EMAC_LED_OVERRIDE); - } - else { - REG_WR(bp, BNX2_EMAC_LED, BNX2_EMAC_LED_OVERRIDE | - BNX2_EMAC_LED_1000MB_OVERRIDE | - BNX2_EMAC_LED_100MB_OVERRIDE | - BNX2_EMAC_LED_10MB_OVERRIDE | - BNX2_EMAC_LED_TRAFFIC_OVERRIDE | - BNX2_EMAC_LED_TRAFFIC); - } - msleep_interruptible(500); - if (signal_pending(current)) - break; - } - REG_WR(bp, BNX2_EMAC_LED, 0); - REG_WR(bp, BNX2_MISC_CFG, save); + case ETHTOOL_ID_OFF: + REG_WR(bp, BNX2_EMAC_LED, BNX2_EMAC_LED_OVERRIDE); + break; - if (!netif_running(dev)) - bnx2_set_power_state(bp, PCI_D3hot); + case ETHTOOL_ID_INACTIVE: + REG_WR(bp, BNX2_EMAC_LED, 0); + REG_WR(bp, BNX2_MISC_CFG, bp->leds_save); + + if (!netif_running(dev)) + bnx2_set_power_state(bp, PCI_D3hot); + break; + } return 0; } @@ -7602,7 +7600,7 @@ static const struct ethtool_ops bnx2_ethtool_ops = { .set_tso = bnx2_set_tso, .self_test = bnx2_self_test, .get_strings = bnx2_get_strings, - .phys_id = bnx2_phys_id, + .set_phys_id = bnx2_set_phys_id, .get_ethtool_stats = bnx2_get_ethtool_stats, .get_sset_count = bnx2_get_sset_count, .set_flags = bnx2_set_flags, diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h index 68020451dc4f..91e83562238e 100644 --- a/drivers/net/bnx2.h +++ b/drivers/net/bnx2.h @@ -6922,6 +6922,7 @@ struct bnx2 { u8 num_tx_rings; u8 num_rx_rings; + u32 leds_save; u32 idle_chk_status_idx; #ifdef BCM_CNIC |