diff options
author | stephen hemminger <shemminger@vyatta.com> | 2011-04-04 04:43:42 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-06 17:30:07 -0400 |
commit | a5b9f41c228f93d368ab0f292d890ea7143ca5aa (patch) | |
tree | d3a6975c11f4d7933bb349b3bac0cd00b5b72840 /drivers/net/skge.c | |
parent | 74e532ff3c634f20ee2eefe3f8f0083ea547c74c (diff) |
skge: implement set_phys_id
Implement set_phys_id led control on SysKonnect board.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/skge.c')
-rw-r--r-- | drivers/net/skge.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 35b28f42d208..e579ff7579ad 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -786,28 +786,27 @@ static void skge_led(struct skge_port *skge, enum led_mode mode) | |||
786 | } | 786 | } |
787 | 787 | ||
788 | /* blink LED's for finding board */ | 788 | /* blink LED's for finding board */ |
789 | static int skge_phys_id(struct net_device *dev, u32 data) | 789 | static int skge_set_phys_id(struct net_device *dev, |
790 | enum ethtool_phys_id_state state) | ||
790 | { | 791 | { |
791 | struct skge_port *skge = netdev_priv(dev); | 792 | struct skge_port *skge = netdev_priv(dev); |
792 | unsigned long ms; | ||
793 | enum led_mode mode = LED_MODE_TST; | ||
794 | 793 | ||
795 | if (!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ)) | 794 | switch (state) { |
796 | ms = jiffies_to_msecs(MAX_SCHEDULE_TIMEOUT / HZ) * 1000; | 795 | case ETHTOOL_ID_ACTIVE: |
797 | else | 796 | return -EINVAL; |
798 | ms = data * 1000; | ||
799 | 797 | ||
800 | while (ms > 0) { | 798 | case ETHTOOL_ID_ON: |
801 | skge_led(skge, mode); | 799 | skge_led(skge, LED_MODE_TST); |
802 | mode ^= LED_MODE_TST; | 800 | break; |
803 | 801 | ||
804 | if (msleep_interruptible(BLINK_MS)) | 802 | case ETHTOOL_ID_OFF: |
805 | break; | 803 | skge_led(skge, LED_MODE_OFF); |
806 | ms -= BLINK_MS; | 804 | break; |
807 | } | ||
808 | 805 | ||
809 | /* back to regular LED state */ | 806 | case ETHTOOL_ID_INACTIVE: |
810 | skge_led(skge, netif_running(dev) ? LED_MODE_ON : LED_MODE_OFF); | 807 | /* back to regular LED state */ |
808 | skge_led(skge, netif_running(dev) ? LED_MODE_ON : LED_MODE_OFF); | ||
809 | } | ||
811 | 810 | ||
812 | return 0; | 811 | return 0; |
813 | } | 812 | } |
@@ -930,7 +929,7 @@ static const struct ethtool_ops skge_ethtool_ops = { | |||
930 | .get_rx_csum = skge_get_rx_csum, | 929 | .get_rx_csum = skge_get_rx_csum, |
931 | .set_rx_csum = skge_set_rx_csum, | 930 | .set_rx_csum = skge_set_rx_csum, |
932 | .get_strings = skge_get_strings, | 931 | .get_strings = skge_get_strings, |
933 | .phys_id = skge_phys_id, | 932 | .set_phys_id = skge_set_phys_id, |
934 | .get_sset_count = skge_get_sset_count, | 933 | .get_sset_count = skge_get_sset_count, |
935 | .get_ethtool_stats = skge_get_ethtool_stats, | 934 | .get_ethtool_stats = skge_get_ethtool_stats, |
936 | }; | 935 | }; |