Skip to contentSkip to conversation

net: stmmac: socfpga: add runtime suspend/resume callback for stratix10 platform

PATCH Applied Meng Li 2 participants 2 messages Nov 15, 2021

Subsystems (5)
lore
Share & tools
lore

Meng Li

author
#0 lore raw

PATCH v3 1/1 net: stmmac: socfpga: add runtime suspend/resume callback for stratix10 platform

From: Meng Li <[email protected]>

According to upstream commit 5ec55823438e("net: stmmac:
add clocks management for gmac driver"), it improve clocks management for stmmac driver. So, it is necessary to implement the runtime callback in dwmac-socfpga driver because it doesn't use the common stmmac_pltfr_pm_ops instance. Otherwise, clocks are not disabled when system enters suspend status.

Fixes 5ec55823438e ("net: stmmac: add clocks management for gmac driver")

---

v3:
- adjust the static position to fix a building warning

v2:
- add static when define socfpga_dwmac_pm_ops
- add fixed tag

---
 .../ethernet/stmicro/stmmac/dwmac-socfpga.c   | 24 +++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +22 -2
index 85208128f135..e478a4017caa 100644
@@ -485,8 +485,28 @@ static int socfpga_dwmac_resume(struct device *dev)
 }
 #endif /* CONFIG_PM_SLEEP */
 
-static SIMPLE_DEV_PM_OPS(socfpga_dwmac_pm_ops, stmmac_suspend,
-					       socfpga_dwmac_resume);
+static int __maybe_unused socfpga_dwmac_runtime_suspend(struct device *dev)
+{
+	struct net_device *ndev = dev_get_drvdata(dev);
+	struct stmmac_priv *priv = netdev_priv(ndev);
+
+	stmmac_bus_clks_config(priv, false);
+
+	return 0;
+}
+
+static int __maybe_unused socfpga_dwmac_runtime_resume(struct device *dev)
+{
+	struct net_device *ndev = dev_get_drvdata(dev);
+	struct stmmac_priv *priv = netdev_priv(ndev);
+
+	return stmmac_bus_clks_config(priv, true);
+}
+
+static const struct dev_pm_ops socfpga_dwmac_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(stmmac_suspend, socfpga_dwmac_resume)
+	SET_RUNTIME_PM_OPS(socfpga_dwmac_runtime_suspend, socfpga_dwmac_runtime_resume, NULL)
+};
 
 static const struct socfpga_dwmac_ops socfpga_gen5_ops = {
 	.set_phy_mode = socfpga_gen5_set_phy_mode,
Signature · 1 line
2.17.1
#1 lore raw
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:

Quoted 10 lines · On Mon, 15 Nov 2021 15:04:23 +0800 you wrote:

From: Meng Li <[email protected]>

According to upstream commit 5ec55823438e("net: stmmac:
add clocks management for gmac driver"), it improve clocks management for stmmac driver. So, it is necessary to implement the runtime callback in dwmac-socfpga driver because it doesn't use the common stmmac_pltfr_pm_ops instance. Otherwise, clocks are not disabled when system enters suspend status.

[...]

Here is the summary with links:
- [v3] net: stmmac: socfpga: add runtime suspend/resume callback for stratix10 platform

    https://git.kernel.org/netdev/net/c/911957003948

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html