diff options
author | stephen hemminger <shemminger@vyatta.com> | 2011-04-04 04:43:50 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-06 17:30:08 -0400 |
commit | 81b8709c25e8c8f56224a24d860de7b77a772e83 (patch) | |
tree | eabbc21f1308cda329e54cfe25e8237791cd4e77 /drivers/net/tg3.c | |
parent | a5b9f41c228f93d368ab0f292d890ea7143ca5aa (diff) |
tg3: implement ethtool set_phys_id
Implement control of LED via set_phys_id.
Note: since PHY is powered off if device is down, this board
only allows blinking if device is up.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r-- | drivers/net/tg3.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index f944c6b97dd6..d37ae8747ad1 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -10341,35 +10341,38 @@ static void tg3_get_strings(struct net_device *dev, u32 stringset, u8 *buf) | |||
10341 | } | 10341 | } |
10342 | } | 10342 | } |
10343 | 10343 | ||
10344 | static int tg3_phys_id(struct net_device *dev, u32 data) | 10344 | static int tg3_set_phys_id(struct net_device *dev, |
10345 | enum ethtool_phys_id_state state) | ||
10345 | { | 10346 | { |
10346 | struct tg3 *tp = netdev_priv(dev); | 10347 | struct tg3 *tp = netdev_priv(dev); |
10347 | int i; | ||
10348 | 10348 | ||
10349 | if (!netif_running(tp->dev)) | 10349 | if (!netif_running(tp->dev)) |
10350 | return -EAGAIN; | 10350 | return -EAGAIN; |
10351 | 10351 | ||
10352 | if (data == 0) | 10352 | switch (state) { |
10353 | data = UINT_MAX / 2; | 10353 | case ETHTOOL_ID_ACTIVE: |
10354 | return -EINVAL; | ||
10354 | 10355 | ||
10355 | for (i = 0; i < (data * 2); i++) { | 10356 | case ETHTOOL_ID_ON: |
10356 | if ((i % 2) == 0) | 10357 | tw32(MAC_LED_CTRL, LED_CTRL_LNKLED_OVERRIDE | |
10357 | tw32(MAC_LED_CTRL, LED_CTRL_LNKLED_OVERRIDE | | 10358 | LED_CTRL_1000MBPS_ON | |
10358 | LED_CTRL_1000MBPS_ON | | 10359 | LED_CTRL_100MBPS_ON | |
10359 | LED_CTRL_100MBPS_ON | | 10360 | LED_CTRL_10MBPS_ON | |
10360 | LED_CTRL_10MBPS_ON | | 10361 | LED_CTRL_TRAFFIC_OVERRIDE | |
10361 | LED_CTRL_TRAFFIC_OVERRIDE | | 10362 | LED_CTRL_TRAFFIC_BLINK | |
10362 | LED_CTRL_TRAFFIC_BLINK | | 10363 | LED_CTRL_TRAFFIC_LED); |
10363 | LED_CTRL_TRAFFIC_LED); | 10364 | break; |
10364 | 10365 | ||
10365 | else | 10366 | case ETHTOOL_ID_OFF: |
10366 | tw32(MAC_LED_CTRL, LED_CTRL_LNKLED_OVERRIDE | | 10367 | tw32(MAC_LED_CTRL, LED_CTRL_LNKLED_OVERRIDE | |
10367 | LED_CTRL_TRAFFIC_OVERRIDE); | 10368 | LED_CTRL_TRAFFIC_OVERRIDE); |
10369 | break; | ||
10368 | 10370 | ||
10369 | if (msleep_interruptible(500)) | 10371 | case ETHTOOL_ID_INACTIVE: |
10370 | break; | 10372 | tw32(MAC_LED_CTRL, tp->led_ctrl); |
10373 | break; | ||
10371 | } | 10374 | } |
10372 | tw32(MAC_LED_CTRL, tp->led_ctrl); | 10375 | |
10373 | return 0; | 10376 | return 0; |
10374 | } | 10377 | } |
10375 | 10378 | ||
@@ -11394,7 +11397,7 @@ static const struct ethtool_ops tg3_ethtool_ops = { | |||
11394 | .set_tso = tg3_set_tso, | 11397 | .set_tso = tg3_set_tso, |
11395 | .self_test = tg3_self_test, | 11398 | .self_test = tg3_self_test, |
11396 | .get_strings = tg3_get_strings, | 11399 | .get_strings = tg3_get_strings, |
11397 | .phys_id = tg3_phys_id, | 11400 | .set_phys_id = tg3_set_phys_id, |
11398 | .get_ethtool_stats = tg3_get_ethtool_stats, | 11401 | .get_ethtool_stats = tg3_get_ethtool_stats, |
11399 | .get_coalesce = tg3_get_coalesce, | 11402 | .get_coalesce = tg3_get_coalesce, |
11400 | .set_coalesce = tg3_set_coalesce, | 11403 | .set_coalesce = tg3_set_coalesce, |