net: stmmac: fix wrong place to call pinctrl state change

Message ID 20240126024433.2928223-1-xiaoning.wang@nxp.com
State New
Headers
Series net: stmmac: fix wrong place to call pinctrl state change |

Commit Message

Clark Wang Jan. 26, 2024, 2:44 a.m. UTC
  The previous patch put the phylink_suspend after the pm_runtime_force_suspend
to fix an issue. But in phylink_suspend, it will call mdio read/write. If the
iomux of the pins of MDIO bus have been changed to others, the MDIO bus will
not functional.
So put pinctrl_pm_select_sleep_state to the right place to fix this issue.

Fixes: 90702dcd19c0 ("net: stmmac: fix MAC not working when system resume back with WoL active")
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Reviewed-by: Wei Fang <wei.fang@nxp.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index b334eb16da23..9104ebf49c5d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7851,7 +7851,6 @@  int stmmac_suspend(struct device *dev)
 		priv->irq_wake = 1;
 	} else {
 		stmmac_mac_set(priv, priv->ioaddr, false);
-		pinctrl_pm_select_sleep_state(priv->device);
 	}
 
 	mutex_unlock(&priv->lock);
@@ -7863,6 +7862,7 @@  int stmmac_suspend(struct device *dev)
 		if (device_may_wakeup(priv->device))
 			phylink_speed_down(priv->phylink, false);
 		phylink_suspend(priv->phylink, false);
+		pinctrl_pm_select_sleep_state(priv->device);
 	}
 	rtnl_unlock();