@@ -3102,8 +3102,15 @@ fec_enet_get_eee(struct net_device *ndev, struct ethtool_eee *edata)
struct fec_enet_private *fep = netdev_priv(ndev);
struct ethtool_eee *p = &fep->eee;
- if (!(fep->quirks & FEC_QUIRK_HAS_EEE))
- return -EOPNOTSUPP;
+ if (!(fep->quirks & FEC_QUIRK_HAS_EEE)) {
+ if (!netif_running(ndev))
+ return -ENETDOWN;
+
+ if (!phy_has_smarteee(ndev->phydev))
+ return -EOPNOTSUPP;
+
+ return phy_ethtool_get_eee(ndev->phydev, edata);
+ }
if (!netif_running(ndev))
return -ENETDOWN;
@@ -3123,8 +3130,15 @@ fec_enet_set_eee(struct net_device *ndev, struct ethtool_eee *edata)
struct ethtool_eee *p = &fep->eee;
int ret = 0;
- if (!(fep->quirks & FEC_QUIRK_HAS_EEE))
- return -EOPNOTSUPP;
+ if (!(fep->quirks & FEC_QUIRK_HAS_EEE)) {
+ if (!netif_running(ndev))
+ return -ENETDOWN;
+
+ if (!phy_has_smarteee(ndev->phydev))
+ return -EOPNOTSUPP;
+
+ return phy_ethtool_set_eee(ndev->phydev, edata);
+ }
if (!netif_running(ndev))
return -ENETDOWN;
Ethernet controller in i.MX6*/i.MX7* series do not provide EEE support. But this chips are used sometimes in combinations with SmartEEE capable PHYs. So, instead of aborting get/set_eee access on MACs without EEE support, ask PHY if it is able to do the EEE job by using SmartEEE. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> --- drivers/net/ethernet/freescale/fec_main.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)