Re: [PATCH 1/3] net: stmmac: fix pinctrl management during suspend/resume

From: Russell King (Oracle)

Date: Wed Feb 18 2026 - 03:52:55 EST


On Wed, Feb 18, 2026 at 09:36:16AM +0100, Christophe Roullier wrote:
> In the deepest low power modes the pinctrl are lost and never restored
> if the interface is down.
> This commit makes sure that pinctrl modes are set in all the cases.
>
> Signed-off-by: Christophe Roullier <christophe.roullier@xxxxxxxxxxx>
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index c63099a77cc0c..067b17f03cd09 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -8133,6 +8133,8 @@ int stmmac_suspend(struct device *dev)
> ethtool_mmsv_stop(&priv->fpe_cfg.mmsv);
>
> suspend_bsp:
> + /* Select sleep pin state */
> + pinctrl_pm_select_sleep_state(dev);

This is wrong. Look above, this, and you will notice that
pinctrl_pm_select_sleep_state() is called _conditionally_, depending
on whether the MAC is doing WoL or not. If WoL is enabled, the MAC
needs to stay functional, which means its pins need to stay properly
configured.

So, we can't unconditionally call this. I suggest moving this to:

- if (!ndev || !netif_running(ndev)) {
+ if (!ndev || !netif_running(ndev)) {
+ /* Select sleep pin state */
+ pinctrl_pm_select_sleep_state(dev);
goto suspend_bsp;
+ }

> if (priv->plat->suspend)
> return priv->plat->suspend(dev, priv->plat->bsp_priv);
>
> @@ -8194,8 +8196,11 @@ int stmmac_resume(struct device *dev)
> return ret;
> }
>
> - if (!netif_running(ndev))
> + if (!netif_running(ndev)) {
> + /* Select default pin state */
> + pinctrl_pm_select_default_state(priv->device);
> return 0;
> + }

This looks fine to me.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!