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

Clark Wang xiaoning.wang at nxp.com
Wed Nov 30 03:11:48 PST 2022


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 at nxp.com>
---
 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




More information about the linux-arm-kernel mailing list