aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstephen hemminger <shemminger@vyatta.com>2011-04-04 04:43:51 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-06 17:30:08 -0400
commit12fcf941674fd781117a56f998d2bb28b4bc4cf1 (patch)
treebe1565d6a9a2407f55fef8dcc6200911e611971a
parent81b8709c25e8c8f56224a24d860de7b77a772e83 (diff)
cxgb3: implement set_phys_id
Implement new ethtool set_phys_id on Chelsio cxgb3 board. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 910893143295..802c7a7c3b25 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -1749,23 +1749,26 @@ static int restart_autoneg(struct net_device *dev)
1749 return 0; 1749 return 0;
1750} 1750}
1751 1751
1752static int cxgb3_phys_id(struct net_device *dev, u32 data) 1752static int set_phys_id(struct net_device *dev,
1753 enum ethtool_phys_id_state state)
1753{ 1754{
1754 struct port_info *pi = netdev_priv(dev); 1755 struct port_info *pi = netdev_priv(dev);
1755 struct adapter *adapter = pi->adapter; 1756 struct adapter *adapter = pi->adapter;
1756 int i;
1757 1757
1758 if (data == 0) 1758 switch (state) {
1759 data = 2; 1759 case ETHTOOL_ID_ACTIVE:
1760 return -EINVAL;
1761
1762 case ETHTOOL_ID_OFF:
1763 t3_set_reg_field(adapter, A_T3DBG_GPIO_EN, F_GPIO0_OUT_VAL, 0);
1764 break;
1760 1765
1761 for (i = 0; i < data * 2; i++) { 1766 case ETHTOOL_ID_ON:
1767 case ETHTOOL_ID_INACTIVE:
1762 t3_set_reg_field(adapter, A_T3DBG_GPIO_EN, F_GPIO0_OUT_VAL, 1768 t3_set_reg_field(adapter, A_T3DBG_GPIO_EN, F_GPIO0_OUT_VAL,
1763 (i & 1) ? F_GPIO0_OUT_VAL : 0);
1764 if (msleep_interruptible(500))
1765 break;
1766 }
1767 t3_set_reg_field(adapter, A_T3DBG_GPIO_EN, F_GPIO0_OUT_VAL,
1768 F_GPIO0_OUT_VAL); 1769 F_GPIO0_OUT_VAL);
1770 }
1771
1769 return 0; 1772 return 0;
1770} 1773}
1771 1774
@@ -2107,7 +2110,7 @@ static const struct ethtool_ops cxgb_ethtool_ops = {
2107 .set_sg = ethtool_op_set_sg, 2110 .set_sg = ethtool_op_set_sg,
2108 .get_link = ethtool_op_get_link, 2111 .get_link = ethtool_op_get_link,
2109 .get_strings = get_strings, 2112 .get_strings = get_strings,
2110 .phys_id = cxgb3_phys_id, 2113 .set_phys_id = set_phys_id,
2111 .nway_reset = restart_autoneg, 2114 .nway_reset = restart_autoneg,
2112 .get_sset_count = get_sset_count, 2115 .get_sset_count = get_sset_count,
2113 .get_ethtool_stats = get_stats, 2116 .get_ethtool_stats = get_stats,