aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstephen hemminger <shemminger@vyatta.com>2011-04-04 07:06:36 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-06 17:35:21 -0400
commit2e17e1aa80e914acd8a31a41b9bf1173186a976a (patch)
treea3a5f0969aefd30dc2c210c53ccfcb8f807ea89b
parent6d8a7e6f52b0bf646739f2d4bad4643c64977b2a (diff)
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>
-rw-r--r--drivers/net/bnx2.c56
-rw-r--r--drivers/net/bnx2.h1
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,
7495} 7495}
7496 7496
7497static int 7497static int
7498bnx2_phys_id(struct net_device *dev, u32 data) 7498bnx2_set_phys_id(struct net_device *dev, enum ethtool_phys_id_state state)
7499{ 7499{
7500 struct bnx2 *bp = netdev_priv(dev); 7500 struct bnx2 *bp = netdev_priv(dev);
7501 int i;
7502 u32 save;
7503 7501
7504 bnx2_set_power_state(bp, PCI_D0); 7502 switch (state) {
7503 case ETHTOOL_ID_ACTIVE:
7504 bnx2_set_power_state(bp, PCI_D0);
7505 7505
7506 if (data == 0) 7506 bp->leds_save = REG_RD(bp, BNX2_MISC_CFG);
7507 data = 2; 7507 REG_WR(bp, BNX2_MISC_CFG, BNX2_MISC_CFG_LEDMODE_MAC);
7508 return -EINVAL;
7508 7509
7509 save = REG_RD(bp, BNX2_MISC_CFG); 7510 case ETHTOOL_ID_ON:
7510 REG_WR(bp, BNX2_MISC_CFG, BNX2_MISC_CFG_LEDMODE_MAC); 7511 REG_WR(bp, BNX2_EMAC_LED, BNX2_EMAC_LED_OVERRIDE |
7512 BNX2_EMAC_LED_1000MB_OVERRIDE |
7513 BNX2_EMAC_LED_100MB_OVERRIDE |
7514 BNX2_EMAC_LED_10MB_OVERRIDE |
7515 BNX2_EMAC_LED_TRAFFIC_OVERRIDE |
7516 BNX2_EMAC_LED_TRAFFIC);
7517 break;
7511 7518
7512 for (i = 0; i < (data * 2); i++) { 7519 case ETHTOOL_ID_OFF:
7513 if ((i % 2) == 0) { 7520 REG_WR(bp, BNX2_EMAC_LED, BNX2_EMAC_LED_OVERRIDE);
7514 REG_WR(bp, BNX2_EMAC_LED, BNX2_EMAC_LED_OVERRIDE); 7521 break;
7515 }
7516 else {
7517 REG_WR(bp, BNX2_EMAC_LED, BNX2_EMAC_LED_OVERRIDE |
7518 BNX2_EMAC_LED_1000MB_OVERRIDE |
7519 BNX2_EMAC_LED_100MB_OVERRIDE |
7520 BNX2_EMAC_LED_10MB_OVERRIDE |
7521 BNX2_EMAC_LED_TRAFFIC_OVERRIDE |
7522 BNX2_EMAC_LED_TRAFFIC);
7523 }
7524 msleep_interruptible(500);
7525 if (signal_pending(current))
7526 break;
7527 }
7528 REG_WR(bp, BNX2_EMAC_LED, 0);
7529 REG_WR(bp, BNX2_MISC_CFG, save);
7530 7522
7531 if (!netif_running(dev)) 7523 case ETHTOOL_ID_INACTIVE:
7532 bnx2_set_power_state(bp, PCI_D3hot); 7524 REG_WR(bp, BNX2_EMAC_LED, 0);
7525 REG_WR(bp, BNX2_MISC_CFG, bp->leds_save);
7526
7527 if (!netif_running(dev))
7528 bnx2_set_power_state(bp, PCI_D3hot);
7529 break;
7530 }
7533 7531
7534 return 0; 7532 return 0;
7535} 7533}
@@ -7602,7 +7600,7 @@ static const struct ethtool_ops bnx2_ethtool_ops = {
7602 .set_tso = bnx2_set_tso, 7600 .set_tso = bnx2_set_tso,
7603 .self_test = bnx2_self_test, 7601 .self_test = bnx2_self_test,
7604 .get_strings = bnx2_get_strings, 7602 .get_strings = bnx2_get_strings,
7605 .phys_id = bnx2_phys_id, 7603 .set_phys_id = bnx2_set_phys_id,
7606 .get_ethtool_stats = bnx2_get_ethtool_stats, 7604 .get_ethtool_stats = bnx2_get_ethtool_stats,
7607 .get_sset_count = bnx2_get_sset_count, 7605 .get_sset_count = bnx2_get_sset_count,
7608 .set_flags = bnx2_set_flags, 7606 .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 {
6922 u8 num_tx_rings; 6922 u8 num_tx_rings;
6923 u8 num_rx_rings; 6923 u8 num_rx_rings;
6924 6924
6925 u32 leds_save;
6925 u32 idle_chk_status_idx; 6926 u32 idle_chk_status_idx;
6926 6927
6927#ifdef BCM_CNIC 6928#ifdef BCM_CNIC