[PATCH net v2 1/2] net: phylink: call phy_init_hw() in phylink resume path
From: Ovidiu Panait
Date: Thu Apr 09 2026 - 06:03:01 EST
When mac_managed_pm flag is set, mdio_bus_phy_resume() is skipped,
so phy_init_hw(), which performs soft_reset and config_init, is not
called during resume.
This is inconsistent with the non-mac_managed_pm path, where
mdio_bus_phy_resume() calls phy_init_hw() before phy_resume()
on every resume.
Add phy_init_hw() calls in both phylink_prepare_resume() and
phylink_resume(), to ensure that the PHY state is the same as
when the PHY is resumed via the MDIO bus.
Signed-off-by: Ovidiu Panait <ovidiu.panait.rb@xxxxxxxxxxx>
---
drivers/net/phy/phylink.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 087ac63f9193..c302126009f6 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -2669,8 +2669,10 @@ void phylink_prepare_resume(struct phylink *pl)
* then resume the PHY. Note that 802.3 allows PHYs 500ms before
* the clock meets requirements. We do not implement this delay.
*/
- if (pl->config->mac_requires_rxc && phydev && phydev->suspended)
+ if (pl->config->mac_requires_rxc && phydev && phydev->suspended) {
+ phy_init_hw(phydev);
phy_resume(phydev);
+ }
}
EXPORT_SYMBOL_GPL(phylink_prepare_resume);
@@ -2683,6 +2685,8 @@ EXPORT_SYMBOL_GPL(phylink_prepare_resume);
*/
void phylink_resume(struct phylink *pl)
{
+ struct phy_device *phydev = pl->phydev;
+
ASSERT_RTNL();
if (phylink_phy_pm_speed_ctrl(pl))
@@ -2712,6 +2716,9 @@ void phylink_resume(struct phylink *pl)
/* Re-enable and re-resolve the link parameters */
phylink_enable_and_run_resolve(pl, PHYLINK_DISABLE_MAC_WOL);
} else {
+ if (phydev && phydev->suspended)
+ phy_init_hw(phydev);
+
phylink_start(pl);
}
}
--
2.34.1