netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: stmmac: dwmac-rk: Fix disabling set_clock_selection
@ 2025-10-14 15:49 Sebastian Reichel
  2025-10-16 12:44 ` Simon Horman
  2025-10-17  1:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Sebastian Reichel @ 2025-10-14 15:49 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Maxime Coquelin, Alexandre Torgue, David Wu
  Cc: netdev, linux-rockchip, linux-kernel, kernel, stable,
	Sebastian Reichel

On all platforms set_clock_selection() writes to a GRF register. This
requires certain clocks running and thus should happen before the
clocks are disabled.

This has been noticed on RK3576 Sige5, which hangs during system suspend
when trying to suspend the second network interface. Note, that
suspending the first interface works, because the second device ensures
that the necessary clocks for the GRF are enabled.

Cc: stable@vger.kernel.org
Fixes: 2f2b60a0ec28 ("net: ethernet: stmmac: dwmac-rk: Add gmac support for rk3588")
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
index 51ea0caf16c1..0786816e05f0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -1446,14 +1446,15 @@ static int gmac_clk_enable(struct rk_priv_data *bsp_priv, bool enable)
 		}
 	} else {
 		if (bsp_priv->clk_enabled) {
+			if (bsp_priv->ops && bsp_priv->ops->set_clock_selection) {
+				bsp_priv->ops->set_clock_selection(bsp_priv,
+					      bsp_priv->clock_input, false);
+			}
+
 			clk_bulk_disable_unprepare(bsp_priv->num_clks,
 						   bsp_priv->clks);
 			clk_disable_unprepare(bsp_priv->clk_phy);
 
-			if (bsp_priv->ops && bsp_priv->ops->set_clock_selection)
-				bsp_priv->ops->set_clock_selection(bsp_priv,
-					      bsp_priv->clock_input, false);
-
 			bsp_priv->clk_enabled = false;
 		}
 	}

---
base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
change-id: 20251014-rockchip-network-clock-fix-2c7069a6b6ec

Best regards,
-- 
Sebastian Reichel <sebastian.reichel@collabora.com>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: stmmac: dwmac-rk: Fix disabling set_clock_selection
  2025-10-14 15:49 [PATCH net] net: stmmac: dwmac-rk: Fix disabling set_clock_selection Sebastian Reichel
@ 2025-10-16 12:44 ` Simon Horman
  2025-10-17  1:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2025-10-16 12:44 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Maxime Coquelin, Alexandre Torgue, David Wu, netdev,
	linux-rockchip, linux-kernel, kernel, stable

On Tue, Oct 14, 2025 at 05:49:34PM +0200, Sebastian Reichel wrote:
> On all platforms set_clock_selection() writes to a GRF register. This
> requires certain clocks running and thus should happen before the
> clocks are disabled.
> 
> This has been noticed on RK3576 Sige5, which hangs during system suspend
> when trying to suspend the second network interface. Note, that
> suspending the first interface works, because the second device ensures
> that the necessary clocks for the GRF are enabled.
> 
> Cc: stable@vger.kernel.org
> Fixes: 2f2b60a0ec28 ("net: ethernet: stmmac: dwmac-rk: Add gmac support for rk3588")
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: stmmac: dwmac-rk: Fix disabling set_clock_selection
  2025-10-14 15:49 [PATCH net] net: stmmac: dwmac-rk: Fix disabling set_clock_selection Sebastian Reichel
  2025-10-16 12:44 ` Simon Horman
@ 2025-10-17  1:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-10-17  1:50 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, mcoquelin.stm32,
	alexandre.torgue, david.wu, netdev, linux-rockchip, linux-kernel,
	kernel, stable

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 14 Oct 2025 17:49:34 +0200 you wrote:
> On all platforms set_clock_selection() writes to a GRF register. This
> requires certain clocks running and thus should happen before the
> clocks are disabled.
> 
> This has been noticed on RK3576 Sige5, which hangs during system suspend
> when trying to suspend the second network interface. Note, that
> suspending the first interface works, because the second device ensures
> that the necessary clocks for the GRF are enabled.
> 
> [...]

Here is the summary with links:
  - [net] net: stmmac: dwmac-rk: Fix disabling set_clock_selection
    https://git.kernel.org/netdev/net/c/7f864458e9a6

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-10-17  1:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-14 15:49 [PATCH net] net: stmmac: dwmac-rk: Fix disabling set_clock_selection Sebastian Reichel
2025-10-16 12:44 ` Simon Horman
2025-10-17  1:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).