summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnathan Mantey <johnathanx.mantey@intel.com>2020-01-27 20:03:56 +0300
committerJae Hyun Yoo <jae.hyun.yoo@intel.com>2021-07-14 20:02:36 +0300
commitf679197a37acf22f39b51e4b35836462903aeda2 (patch)
tree4345bba1d33f296ab7ac76c87e6a402c5f1631a5
parent803b8201cc0239cf0a2125e75d5de29658f889b9 (diff)
downloadlinux-f679197a37acf22f39b51e4b35836462903aeda2.tar.xz
Return link speed and duplex settings for the NCSI channel
The ftgmac100_open function initializes state for the NCSI channel. The get link settings function does not return this data. This caused the link speed, and the duplex value to be returned incorrectly by the PHY driver (0 Mbps, and duplex off). Update the driver to return either the PHY settings when not using NCSI, or the NCSI values that were assigned when the driver is opened. Signed-off-by: Johnathan Mantey <johnathanx.mantey@intel.com>
-rw-r--r--drivers/net/ethernet/faraday/ftgmac100.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index 1c7912a94e36..5ada2caf48b1 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -1226,10 +1226,30 @@ static int ftgmac100_set_pauseparam(struct net_device *netdev,
return 0;
}
+int ftgmac100_ethtool_get_link_ksettings(struct net_device *netdev,
+ struct ethtool_link_ksettings *cmd)
+{
+ struct phy_device *phydev = netdev->phydev;
+ struct ftgmac100 *priv = netdev_priv(netdev);
+ int retval = 0;
+
+ if (phydev) {
+ phy_ethtool_ksettings_get(phydev, cmd);
+ } else if (priv->use_ncsi) {
+ cmd->base.speed = priv->cur_speed;
+ cmd->base.duplex = priv->cur_duplex;
+ cmd->base.autoneg = 0;
+ } else {
+ retval = -ENODEV;
+ }
+
+ return retval;
+}
+
static const struct ethtool_ops ftgmac100_ethtool_ops = {
.get_drvinfo = ftgmac100_get_drvinfo,
.get_link = ethtool_op_get_link,
- .get_link_ksettings = phy_ethtool_get_link_ksettings,
+ .get_link_ksettings = ftgmac100_ethtool_get_link_ksettings,
.set_link_ksettings = phy_ethtool_set_link_ksettings,
.nway_reset = phy_ethtool_nway_reset,
.get_ringparam = ftgmac100_get_ringparam,