]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: stmmac: convert to phylink managed WoL PHY speed
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Thu, 23 Oct 2025 09:16:55 +0000 (10:16 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 25 Oct 2025 01:52:08 +0000 (18:52 -0700)
Convert stmmac to use phylink's management of the PHY speed when
Wake-on-Lan is enabled.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1vBrRH-0000000BLzm-3JjF@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac.h
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index f128d25346a9bf0ae1f2d5aa5fc8cd343524413b..d5af9344dfb03195b20e7d8baa1e612067526407 100644 (file)
@@ -380,11 +380,6 @@ enum stmmac_state {
 
 extern const struct dev_pm_ops stmmac_simple_pm_ops;
 
-static inline bool stmmac_wol_enabled_phy(struct stmmac_priv *priv)
-{
-       return !priv->plat->pmt && device_may_wakeup(priv->device);
-}
-
 int stmmac_mdio_unregister(struct net_device *ndev);
 int stmmac_mdio_register(struct net_device *ndev);
 int stmmac_mdio_reset(struct mii_bus *mii);
index 08b570bc60c76cf1a9b3dd9e95214cbfab26a856..b155e71aac51f9dd88fc01ab5dace94978cd3ef2 100644 (file)
@@ -730,13 +730,8 @@ static void stmmac_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
 static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
 {
        struct stmmac_priv *priv = netdev_priv(dev);
-       int ret;
 
-       ret = phylink_ethtool_set_wol(priv->phylink, wol);
-       if (!ret)
-               device_set_wakeup_enable(priv->device, !!wol->wolopts);
-
-       return ret;
+       return phylink_ethtool_set_wol(priv->phylink, wol);
 }
 
 static int stmmac_ethtool_op_get_eee(struct net_device *dev,
index af4eb94f0f4f00454a158ea41ba6b6900eb8a82a..fd51068801928e138c3b483a1115b59b5ffa955a 100644 (file)
@@ -1205,14 +1205,6 @@ static int stmmac_init_phy(struct net_device *dev)
                phylink_ethtool_set_eee(priv->phylink, &eee);
        }
 
-       if (!priv->plat->pmt) {
-               struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };
-
-               phylink_ethtool_get_wol(priv->phylink, &wol);
-               device_set_wakeup_capable(priv->device, !!wol.supported);
-               device_set_wakeup_enable(priv->device, !!wol.wolopts);
-       }
-
        return 0;
 }
 
@@ -1281,6 +1273,7 @@ static int stmmac_phylink_setup(struct stmmac_priv *priv)
                config->eee_enabled_default = true;
        }
 
+       config->wol_phy_speed_ctrl = true;
        if (priv->plat->flags & STMMAC_FLAG_USE_PHY_WOL) {
                config->wol_phy_legacy = true;
        } else {
@@ -7795,9 +7788,6 @@ int stmmac_suspend(struct device *dev)
        mutex_unlock(&priv->lock);
 
        rtnl_lock();
-       if (stmmac_wol_enabled_phy(priv))
-               phylink_speed_down(priv->phylink, false);
-
        phylink_suspend(priv->phylink, !!priv->wolopts);
        rtnl_unlock();
 
@@ -7936,9 +7926,6 @@ int stmmac_resume(struct device *dev)
         * workqueue thread, which will race with initialisation.
         */
        phylink_resume(priv->phylink);
-       if (stmmac_wol_enabled_phy(priv))
-               phylink_speed_up(priv->phylink);
-
        rtnl_unlock();
 
        netif_device_attach(ndev);