[PATCH 2/2] net: stmmac: synchronize status with phylink via flag during suspend/resume
From: Clark Wang
Date: Wed Nov 30 2022 - 06:13:00 EST
On some platforms, mac cannot work after resumed from the suspend with WoL
enabled.
We found the stmmac_hw_setup() when system resumes will called after the
stmmac_mac_link_up(). So the correct values set in stmmac_mac_link_up()
are overwritten by stmmac_core_init() in phylink_resolve().
So use the flag added in phylink to keep phylink_resolve() is executed
after the stmmac_hw_setup().
Signed-off-by: Clark Wang <xiaoning.wang@xxxxxxx>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 18c7ca29da2c..4f89061cc537 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7432,6 +7432,7 @@ int stmmac_suspend(struct device *dev)
phylink_speed_down(priv->phylink, false);
phylink_suspend(priv->phylink, false);
}
+ phylink_clear_mac_ready(priv->phylink);
rtnl_unlock();
if (priv->dma_cap.fpesel) {
@@ -7545,6 +7546,7 @@ int stmmac_resume(struct device *dev)
stmmac_clear_descriptors(priv, &priv->dma_conf);
stmmac_hw_setup(ndev, false);
+ phylink_set_mac_ready(priv->phylink);
stmmac_init_coalesce(priv);
stmmac_set_rx_mode(ndev);
--
2.34.1