net: stmmac: socfpga: add runtime suspend/resume callback for stratix10 platform
Subsystems (5)
PATCH 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.
--- .../ethernet/stmicro/stmmac/dwmac-socfpga.c | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +22 -2
@@ -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); +} + +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
11/11/21 4:56 PM, Meng Li пишет:
Quoted 8 lines
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 commonstmmac_pltfr_pm_opsinstance. Otherwise, clocks are not disabled when system enters suspend status.
Please add Fixes tag
Quoted 12 lines
Signed-off-by Meng Li <[email protected]>--- .../ethernet/stmicro/stmmac/dwmac-socfpga.c | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +0
-0@@ -485,8 +485,28 @@ static int socfpga_dwmac_resume(struct device *dev) }
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c static int socfpga_dwmac_resume(struct device *dev) · line 493
Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +6
-2#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);
check the return value?
Quoted 20 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +16
-0+ +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); +} + +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,
Jakub Kicinski
maintainerQuoted 1 line · On Thu, 11 Nov 2021 21:56:30 +0800 Meng Li wrote:
+const struct
dev_pm_opssocfpga_dwmac_pm_ops= {
static
Quoted 18 lines
-----Original Message-----
From: Denis Kirjanov <[email protected]>
Sent: Thursday, November 11, 2021 10:02 PM
To: Li, Meng <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] net: stmmac: socfpga: add runtime suspend/resume callback for stratix10 platform[Please note: This e-mail is from an EXTERNAL e-mail address]
11/11/21 4:56 PM, Meng Li пишет:
Quoted 2 lines
From: Meng Li <[email protected]>
Quoted 8 lines
Quoted 6 lines
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 commonstmmac_pltfr_pm_opsinstance. Otherwise, clocks are not disabled when system enters suspend status.Please add Fixes tag
Thanks for suggest.
Yes! this patch is used to fix an clock operation issue in dwmac-socfpga driver,
But I am not sure which Fixing commit ID I should use.
Because 5ec55823438e breaks the original clock operation of dwmac-socfpga driver, but this commit 5ec55823438e is not a bug. Moreover, if without 5ec55823438e dwmac-socfpga driver also works fine.
How about your suggest?
Thanks,
Limeng
Quoted 48 lines
Quoted 4 lines
Signed-off-by Meng Li <[email protected]>--- .../ethernet/stmicro/stmmac/dwmac-socfpga.c | 24+++++++++++++++++--
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c static int socfpga_dwmac_resume(struct device
Quoted 8 lines
1 file changed, 22 insertions(+), 2 deletions(-)drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +0
-0@@ -485,8 +485,28 @@ static int socfpga_dwmac_resume(struct device*dev)
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c static int socfpga_dwmac_resume(struct device *dev)
Quoted 6 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +1
-2}#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(structdevice
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c static int socfpga_dwmac_resume(struct device *dev) · line 493
Quoted 5 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +5
-0+*dev) { +struct net_device *ndev =dev_get_drvdata (dev); +struct stmmac_priv *priv =netdev_priv (ndev); + +stmmac_bus_clks_config (priv, false);check the return value?
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c static int socfpga_dwmac_resume(struct device *dev)
Quoted 5 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +5
-0+ +return 0 ; +} + +static int __maybe_unused socfpga_dwmac_runtime_resume(structdevice
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c static int socfpga_dwmac_resume(struct device *dev)
Quoted 8 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +8
-0+*dev) { +struct net_device *ndev =dev_get_drvdata (dev); +struct stmmac_priv *priv =netdev_priv (ndev); + +return stmmac_bus_clks_config (priv, true); } + +const struct dev_pm_ops socfpga_dwmac_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(stmmac_suspend,
socfpga_dwmac_resume)Quoted 6 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +2
-0+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,
11/11/21 5:16 PM, Li, Meng пишет:
Quoted 25 lines
Quoted 25 lines
-----Original Message-----
From: Denis Kirjanov <[email protected]>
Sent: Thursday, November 11, 2021 10:02 PM
To: Li, Meng <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] net: stmmac: socfpga: add runtime suspend/resume callback for stratix10 platform[Please note: This e-mail is from an EXTERNAL e-mail address]
11/11/21 4:56 PM, Meng Li пишет:
Quoted 8 lines
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 commonstmmac_pltfr_pm_opsinstance. Otherwise, clocks are not disabled when system enters suspend status.
Quoted 7 lines
Quoted 1 line
Please add Fixes tag
Thanks for suggest.
Yes! this patch is used to fix an clock operation issue in dwmac-socfpga driver,
But I am not sure which Fixing commit ID I should use.
Because5ec55823438ebreaks the original clock operation of dwmac-socfpga driver, but this commit5ec55823438eis not a bug. Moreover, if without5ec55823438edwmac-socfpga driver also works fine.
Yes I see. I also checked the commit 5ec55823438e and it logically relates to your change
Quoted 54 lines
How about your suggest?
Thanks,
LimengQuoted 48 lines
Quoted 4 lines
Signed-off-by Meng Li <[email protected]>--- .../ethernet/stmicro/stmmac/dwmac-socfpga.c | 24+++++++++++++++++--
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c static int socfpga_dwmac_resume(struct device
Quoted 8 lines
1 file changed, 22 insertions(+), 2 deletions(-)drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +0
-0@@ -485,8 +485,28 @@ static int socfpga_dwmac_resume(struct device*dev)
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c static int socfpga_dwmac_resume(struct device *dev)
Quoted 6 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +1
-2}#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(structdevice
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c static int socfpga_dwmac_resume(struct device *dev) · line 493
Quoted 5 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +5
-0+*dev) { +struct net_device *ndev =dev_get_drvdata (dev); +struct stmmac_priv *priv =netdev_priv (ndev); + +stmmac_bus_clks_config (priv, false);check the return value?
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c static int socfpga_dwmac_resume(struct device *dev)
Quoted 5 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +5
-0+ +return 0 ; +} + +static int __maybe_unused socfpga_dwmac_runtime_resume(structdevice
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c static int socfpga_dwmac_resume(struct device *dev)
Quoted 8 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +8
-0+*dev) { +struct net_device *ndev =dev_get_drvdata (dev); +struct stmmac_priv *priv =netdev_priv (ndev); + +return stmmac_bus_clks_config (priv, true); } + +const struct dev_pm_ops socfpga_dwmac_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(stmmac_suspend,
socfpga_dwmac_resume)Quoted 6 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +2
-0+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,