diff options
author | Yegor Yefremov <yegorslists@googlemail.com> | 2016-11-28 09:41:33 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-11-30 10:04:10 -0500 |
commit | a090994980a15f8cc14fc188b5929bd61d2ae9c3 (patch) | |
tree | 84c24f4887c52852019e2809de8ea9b515664003 | |
parent | 93ba2222550415e61f773a8e2ecd1f2a665f5ef5 (diff) | |
download | linux-rt-a090994980a15f8cc14fc188b5929bd61d2ae9c3.tar.gz |
cpsw: ethtool: add support for getting/setting EEE registers
Add the ability to query and set Energy Efficient Ethernet parameters
via ethtool for applicable devices.
This patch doesn't activate full EEE support in cpsw driver, but it
enables reading and writing EEE advertising settings. This way one
can disable advertising EEE for certain speeds.
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Acked-by: Rami Rosen <roszenrami@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/ti/cpsw.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index da40ea577057..df87bfff04f8 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -2237,6 +2237,30 @@ err: return ret; } +static int cpsw_get_eee(struct net_device *ndev, struct ethtool_eee *edata) +{ + struct cpsw_priv *priv = netdev_priv(ndev); + struct cpsw_common *cpsw = priv->cpsw; + int slave_no = cpsw_slave_index(cpsw, priv); + + if (cpsw->slaves[slave_no].phy) + return phy_ethtool_get_eee(cpsw->slaves[slave_no].phy, edata); + else + return -EOPNOTSUPP; +} + +static int cpsw_set_eee(struct net_device *ndev, struct ethtool_eee *edata) +{ + struct cpsw_priv *priv = netdev_priv(ndev); + struct cpsw_common *cpsw = priv->cpsw; + int slave_no = cpsw_slave_index(cpsw, priv); + + if (cpsw->slaves[slave_no].phy) + return phy_ethtool_set_eee(cpsw->slaves[slave_no].phy, edata); + else + return -EOPNOTSUPP; +} + static const struct ethtool_ops cpsw_ethtool_ops = { .get_drvinfo = cpsw_get_drvinfo, .get_msglevel = cpsw_get_msglevel, @@ -2260,6 +2284,8 @@ static const struct ethtool_ops cpsw_ethtool_ops = { .set_channels = cpsw_set_channels, .get_link_ksettings = cpsw_get_link_ksettings, .set_link_ksettings = cpsw_set_link_ksettings, + .get_eee = cpsw_get_eee, + .set_eee = cpsw_set_eee, }; static void cpsw_slave_init(struct cpsw_slave *slave, struct cpsw_common *cpsw, |