summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJohnathan Mantey <johnathanx.mantey@intel.com>2020-01-27 20:03:56 +0300
committerJae Hyun Yoo <jae.hyun.yoo@linux.intel.com>2021-11-05 10:22:09 +0300
commitf865f71af9a17d795d76340ea488d2bf9defa22b (patch)
treeb3b1ccee448ea26adb8d5e1ae086af7eab638f04 /drivers
parent1636487e65c5e9d69638479b6c44953caec33f97 (diff)
downloadlinux-f865f71af9a17d795d76340ea488d2bf9defa22b.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>
Diffstat (limited to 'drivers')
-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 239eb4e2e501..fbaf173ca4a4 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -1255,10 +1255,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,