From: Fabio Estevam <festevam@gmail.com>
To: kuba@kernel.org
Cc: maxime.chevallier@bootlin.com, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com,
qiangqing.zhang@nxp.com, netdev@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux@armlinux.org.uk,
Clark Wang <xiaoning.wang@nxp.com>,
Fabio Estevam <festevam@gmail.com>
Subject: [PATCH net] net: stmmac: Select sleep pin state after suspending phylink
Date: Wed, 29 Jul 2026 19:45:35 -0300 [thread overview]
Message-ID: <20260729224535.506598-1-festevam@gmail.com> (raw)
From: Clark Wang <xiaoning.wang@nxp.com>
When MAC Wake-on-LAN is disabled, stmmac_suspend() selects the sleep
pinctrl state before calling phylink_suspend().
phylink_suspend() may access PHY registers over MDIO while stopping or
reconfiguring the PHY. If selecting the sleep state muxes the MDC and
MDIO pins away from the MDIO bus function, these accesses no longer work.
Select the sleep pin state only after phylink_suspend() has completed.
Keep the transition conditional on MAC Wake-on-LAN being disabled so
that the pins remain active when the MAC must receive wake-up packets.
Fixes: 90702dcd19c0 ("net: stmmac: fix MAC not working when system resume back with WoL active")
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
[fabio: Reworded subject/commit log for clarity and made it priv->wolopts conditional]
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
Based on the NXP kernel fix:
https://github.com/nxp-imx/linux-imx/commit/7905fa71ed07d8c2f1da88ad9fffd5ac5e89461f
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 0de4bc949913..36ab66ad80fd 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -8183,13 +8183,15 @@ 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);
rtnl_lock();
phylink_suspend(priv->phylink, !!priv->wolopts);
+
+ if (!priv->wolopts)
+ pinctrl_pm_select_sleep_state(priv->device);
rtnl_unlock();
if (stmmac_fpe_supported(priv))
--
2.43.0
next reply other threads:[~2026-07-29 22:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-29 22:45 Fabio Estevam [this message]
2026-07-30 7:17 ` [PATCH net] net: stmmac: Select sleep pin state after suspending phylink Maxime Chevallier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260729224535.506598-1-festevam@gmail.com \
--to=festevam@gmail.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux@armlinux.org.uk \
--cc=maxime.chevallier@bootlin.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=qiangqing.zhang@nxp.com \
--cc=xiaoning.wang@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox