* [PATCH] net: fec: fix pinctrl default state restore order on resume
@ 2026-05-26 8:00 Tapio Reijonen
2026-05-26 11:13 ` Wei Fang
0 siblings, 1 reply; 2+ messages in thread
From: Tapio Reijonen @ 2026-05-26 8:00 UTC (permalink / raw)
To: Wei Fang, Frank Li, Shenwei Wang, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Nimrod Andy
Cc: imx, netdev, linux-kernel, Tapio Reijonen
In fec_resume(), fec_enet_clk_enable() is called before
pinctrl_pm_select_default_state() in the non-WoL path, inverting the
ordering used in fec_suspend() which correctly switches to the sleep
pinctrl state before disabling clocks.
For PHYs with the PHY_RST_AFTER_CLK_EN flag (e.g. TI DP83848 or
SMSC LAN87xx), fec_enet_clk_enable() triggers a hardware reset pulse
via the phy-reset GPIO. With the GPIO pin still in sleep pinctrl state
at that point, the GPIO write has no physical effect and the PHY never
receives the required reset after clock enable, leading to unreliable
link establishment after system resume.
Fix by restoring the default pinctrl state before enabling clocks in the
non-WoL resume path, making resume the proper mirror of suspend.
Fixes: de40ed31b3c5 ("net: fec: add Wake-on-LAN support")
Signed-off-by: Tapio Reijonen <tapio.reijonen@vaisala.com>
---
drivers/net/ethernet/freescale/fec_main.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index f89aa94ce0202d5f28f37362ce70e0943aa14025..723af4c057d7aeacb1e90301d95da52b79264400 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -5594,12 +5594,12 @@ static int fec_resume(struct device *dev)
if (fep->rpm_active)
pm_runtime_force_resume(dev);
- ret = fec_enet_clk_enable(ndev, true);
- if (ret) {
- rtnl_unlock();
- goto failed_clk;
- }
if (fep->wol_flag & FEC_WOL_FLAG_ENABLE) {
+ ret = fec_enet_clk_enable(ndev, true);
+ if (ret) {
+ rtnl_unlock();
+ goto failed_clk;
+ }
fec_enet_stop_mode(fep, false);
if (fep->wake_irq) {
disable_irq_wake(fep->wake_irq);
@@ -5612,6 +5612,11 @@ static int fec_resume(struct device *dev)
fep->wol_flag &= ~FEC_WOL_FLAG_SLEEP_ON;
} else {
pinctrl_pm_select_default_state(&fep->pdev->dev);
+ ret = fec_enet_clk_enable(ndev, true);
+ if (ret) {
+ rtnl_unlock();
+ goto failed_clk;
+ }
}
fec_restart(ndev);
netif_tx_lock_bh(ndev);
---
base-commit: 79bd2dded182b1d458b18e62684b7f82ffc682e5
change-id: 20260526-b4-fec-resume-pinctrl-order-fde0cff2bbff
Best regards,
--
Tapio Reijonen <tapio.reijonen@vaisala.com>
^ permalink raw reply [flat|nested] 2+ messages in thread* RE: [PATCH] net: fec: fix pinctrl default state restore order on resume
2026-05-26 8:00 [PATCH] net: fec: fix pinctrl default state restore order on resume Tapio Reijonen
@ 2026-05-26 11:13 ` Wei Fang
0 siblings, 0 replies; 2+ messages in thread
From: Wei Fang @ 2026-05-26 11:13 UTC (permalink / raw)
To: Tapio Reijonen
Cc: imx, netdev, linux-kernel, Frank Li, Shenwei Wang, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
> In fec_resume(), fec_enet_clk_enable() is called before
> pinctrl_pm_select_default_state() in the non-WoL path, inverting the
> ordering used in fec_suspend() which correctly switches to the sleep
> pinctrl state before disabling clocks.
>
> For PHYs with the PHY_RST_AFTER_CLK_EN flag (e.g. TI DP83848 or
> SMSC LAN87xx), fec_enet_clk_enable() triggers a hardware reset pulse
> via the phy-reset GPIO. With the GPIO pin still in sleep pinctrl state
> at that point, the GPIO write has no physical effect and the PHY never
> receives the required reset after clock enable, leading to unreliable
> link establishment after system resume.
>
> Fix by restoring the default pinctrl state before enabling clocks in the
> non-WoL resume path, making resume the proper mirror of suspend.
>
> Fixes: de40ed31b3c5 ("net: fec: add Wake-on-LAN support")
>
Nit: a blank line here, please remove it
> Signed-off-by: Tapio Reijonen <tapio.reijonen@vaisala.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-26 11:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-26 8:00 [PATCH] net: fec: fix pinctrl default state restore order on resume Tapio Reijonen
2026-05-26 11:13 ` Wei Fang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®