diff options
author | Mugunthan V N <mugunthanvnm@ti.com> | 2013-03-11 19:16:36 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-03-13 04:38:19 -0400 |
commit | d3bb9c58b567d240eaaa2dc8bd778696eaed5fbd (patch) | |
tree | ce655632a7db1100ee3bd3405e987fd04d80aa38 /drivers/net/ethernet/ti/cpsw.c | |
parent | e86ac13b031cf71d8f40ff513e627aac80e6b765 (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.c | 29 |
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 | |||
142 | static int debug_level; | 146 | static int debug_level; |
143 | module_param(debug_level, int, 0); | 147 | module_param(debug_level, int, 0); |
144 | MODULE_PARM_DESC(debug_level, "cpsw debug level (NETIF_MSG bits)"); | 148 | MODULE_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 | ||
1251 | static 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 | |||
1263 | static 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 | |||
1247 | static const struct ethtool_ops cpsw_ethtool_ops = { | 1274 | static 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 | ||
1255 | static void cpsw_slave_init(struct cpsw_slave *slave, struct cpsw_priv *priv, | 1284 | static void cpsw_slave_init(struct cpsw_slave *slave, struct cpsw_priv *priv, |