aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/ti/cpsw.c
diff options
context:
space:
mode:
authorMugunthan V N <mugunthanvnm@ti.com>2013-03-11 19:16:36 -0400
committerDavid S. Miller <davem@davemloft.net>2013-03-13 04:38:19 -0400
commitd3bb9c58b567d240eaaa2dc8bd778696eaed5fbd (patch)
treece655632a7db1100ee3bd3405e987fd04d80aa38 /drivers/net/ethernet/ti/cpsw.c
parente86ac13b031cf71d8f40ff513e627aac80e6b765 (diff)
driver: net: ethernet: cpsw: implement ethtool get/set phy setting
This patch implements get/set of the phy settings via ethtool apis Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/ti/cpsw.c')
-rw-r--r--drivers/net/ethernet/ti/cpsw.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 98aa17a9516a..83ce890d6e97 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -139,6 +139,10 @@ do { \
139 disable_irq_nosync(priv->irqs_table[i]); \ 139 disable_irq_nosync(priv->irqs_table[i]); \
140 } while (0); 140 } while (0);
141 141
142#define cpsw_slave_index(priv) \
143 ((priv->data.dual_emac) ? priv->emac_port : \
144 priv->data.active_slave)
145
142static int debug_level; 146static int debug_level;
143module_param(debug_level, int, 0); 147module_param(debug_level, int, 0);
144MODULE_PARM_DESC(debug_level, "cpsw debug level (NETIF_MSG bits)"); 148MODULE_PARM_DESC(debug_level, "cpsw debug level (NETIF_MSG bits)");
@@ -1244,12 +1248,37 @@ static int cpsw_get_ts_info(struct net_device *ndev,
1244 return 0; 1248 return 0;
1245} 1249}
1246 1250
1251static int cpsw_get_settings(struct net_device *ndev,
1252 struct ethtool_cmd *ecmd)
1253{
1254 struct cpsw_priv *priv = netdev_priv(ndev);
1255 int slave_no = cpsw_slave_index(priv);
1256
1257 if (priv->slaves[slave_no].phy)
1258 return phy_ethtool_gset(priv->slaves[slave_no].phy, ecmd);
1259 else
1260 return -EOPNOTSUPP;
1261}
1262
1263static int cpsw_set_settings(struct net_device *ndev, struct ethtool_cmd *ecmd)
1264{
1265 struct cpsw_priv *priv = netdev_priv(ndev);
1266 int slave_no = cpsw_slave_index(priv);
1267
1268 if (priv->slaves[slave_no].phy)
1269 return phy_ethtool_sset(priv->slaves[slave_no].phy, ecmd);
1270 else
1271 return -EOPNOTSUPP;
1272}
1273
1247static const struct ethtool_ops cpsw_ethtool_ops = { 1274static const struct ethtool_ops cpsw_ethtool_ops = {
1248 .get_drvinfo = cpsw_get_drvinfo, 1275 .get_drvinfo = cpsw_get_drvinfo,
1249 .get_msglevel = cpsw_get_msglevel, 1276 .get_msglevel = cpsw_get_msglevel,
1250 .set_msglevel = cpsw_set_msglevel, 1277 .set_msglevel = cpsw_set_msglevel,
1251 .get_link = ethtool_op_get_link, 1278 .get_link = ethtool_op_get_link,
1252 .get_ts_info = cpsw_get_ts_info, 1279 .get_ts_info = cpsw_get_ts_info,
1280 .get_settings = cpsw_get_settings,
1281 .set_settings = cpsw_set_settings,
1253}; 1282};
1254 1283
1255static void cpsw_slave_init(struct cpsw_slave *slave, struct cpsw_priv *priv, 1284static void cpsw_slave_init(struct cpsw_slave *slave, struct cpsw_priv *priv,