diff mbox series

[2/2] net: stmmac: synchronize status with phylink via flag during suspend/resume

Message ID 20221130111148.1064475-3-xiaoning.wang@nxp.com (mailing list archive)
State New, archived
Headers show
Series fix mac not working after system resumed with WoL enabled | expand

Commit Message

Clark Wang Nov. 30, 2022, 11:11 a.m. UTC
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@nxp.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

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);