linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: stmmac: socfpga: add runtime suspend/resume callback for stratix10 platform
@ 2021-11-11 13:56 Meng Li
  2021-11-11 14:01 ` Denis Kirjanov
  2021-11-11 14:09 ` Jakub Kicinski
  0 siblings, 2 replies; 5+ messages in thread
From: Meng Li @ 2021-11-11 13:56 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba, mcoquelin.stm32
  Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel, meng.li

From: Meng Li <meng.li@windriver.com>

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.

Signed-off-by: Meng Li <Meng.Li@windriver.com>
---
 .../ethernet/stmicro/stmmac/dwmac-socfpga.c   | 24 +++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index 85208128f135..93abde467de4 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -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,
-- 
2.17.1


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

* Re: [PATCH] net: stmmac: socfpga: add runtime suspend/resume callback for stratix10 platform
  2021-11-11 13:56 [PATCH] net: stmmac: socfpga: add runtime suspend/resume callback for stratix10 platform Meng Li
@ 2021-11-11 14:01 ` Denis Kirjanov
  2021-11-11 14:16   ` Li, Meng
  2021-11-11 14:09 ` Jakub Kicinski
  1 sibling, 1 reply; 5+ messages in thread
From: Denis Kirjanov @ 2021-11-11 14:01 UTC (permalink / raw)
  To: Meng Li, peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba,
	mcoquelin.stm32
  Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel



11/11/21 4:56 PM, Meng Li пишет:
> From: Meng Li <meng.li@windriver.com>
> 
> 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.

Please add Fixes tag
> 
> Signed-off-by: Meng Li <Meng.Li@windriver.com>
> ---
>   .../ethernet/stmicro/stmmac/dwmac-socfpga.c   | 24 +++++++++++++++++--
>   1 file changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> index 85208128f135..93abde467de4 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> @@ -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);
check the return value?
> +
> +	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,
> 

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

* Re: [PATCH] net: stmmac: socfpga: add runtime suspend/resume callback for stratix10 platform
  2021-11-11 13:56 [PATCH] net: stmmac: socfpga: add runtime suspend/resume callback for stratix10 platform Meng Li
  2021-11-11 14:01 ` Denis Kirjanov
@ 2021-11-11 14:09 ` Jakub Kicinski
  1 sibling, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2021-11-11 14:09 UTC (permalink / raw)
  To: Meng Li
  Cc: peppe.cavallaro, alexandre.torgue, joabreu, davem,
	mcoquelin.stm32, netdev, linux-stm32, linux-arm-kernel,
	linux-kernel

On Thu, 11 Nov 2021 21:56:30 +0800 Meng Li wrote:
> +const struct dev_pm_ops socfpga_dwmac_pm_ops = {

static

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

* RE: [PATCH] net: stmmac: socfpga: add runtime suspend/resume callback for stratix10 platform
  2021-11-11 14:01 ` Denis Kirjanov
@ 2021-11-11 14:16   ` Li, Meng
  2021-11-11 15:02     ` Denis Kirjanov
  0 siblings, 1 reply; 5+ messages in thread
From: Li, Meng @ 2021-11-11 14:16 UTC (permalink / raw)
  To: Denis Kirjanov, peppe.cavallaro, alexandre.torgue, joabreu,
	davem, kuba, mcoquelin.stm32
  Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel



> -----Original Message-----
> From: Denis Kirjanov <dkirjanov@suse.de>
> Sent: Thursday, November 11, 2021 10:02 PM
> To: Li, Meng <Meng.Li@windriver.com>; peppe.cavallaro@st.com;
> alexandre.torgue@foss.st.com; joabreu@synopsys.com;
> davem@davemloft.net; kuba@kernel.org; mcoquelin.stm32@gmail.com
> Cc: netdev@vger.kernel.org; linux-stm32@st-md-mailman.stormreply.com;
> linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org
> 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 пишет:
> > From: Meng Li <meng.li@windriver.com>
> >
> > 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.
> 
> 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

> >
> > Signed-off-by: Meng Li <Meng.Li@windriver.com>
> > ---
> >   .../ethernet/stmicro/stmmac/dwmac-socfpga.c   | 24
> +++++++++++++++++--
> >   1 file changed, 22 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> > b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> > index 85208128f135..93abde467de4 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> > @@ -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);
> check the return value?
> > +
> > +     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,
> >

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

* Re: [PATCH] net: stmmac: socfpga: add runtime suspend/resume callback for stratix10 platform
  2021-11-11 14:16   ` Li, Meng
@ 2021-11-11 15:02     ` Denis Kirjanov
  0 siblings, 0 replies; 5+ messages in thread
From: Denis Kirjanov @ 2021-11-11 15:02 UTC (permalink / raw)
  To: Li, Meng, peppe.cavallaro, alexandre.torgue, joabreu, davem,
	kuba, mcoquelin.stm32
  Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel



11/11/21 5:16 PM, Li, Meng пишет:
> 
> 
>> -----Original Message-----
>> From: Denis Kirjanov <dkirjanov@suse.de>
>> Sent: Thursday, November 11, 2021 10:02 PM
>> To: Li, Meng <Meng.Li@windriver.com>; peppe.cavallaro@st.com;
>> alexandre.torgue@foss.st.com; joabreu@synopsys.com;
>> davem@davemloft.net; kuba@kernel.org; mcoquelin.stm32@gmail.com
>> Cc: netdev@vger.kernel.org; linux-stm32@st-md-mailman.stormreply.com;
>> linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org
>> 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 пишет:
>>> From: Meng Li <meng.li@windriver.com>
>>>
>>> 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.
>>
>> 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.
Yes I see. I also checked the commit 5ec55823438e and it logically 
relates to your change
> 
> How about your suggest?
> 
> Thanks,
> Limeng
> 
>>>
>>> Signed-off-by: Meng Li <Meng.Li@windriver.com>
>>> ---
>>>    .../ethernet/stmicro/stmmac/dwmac-socfpga.c   | 24
>> +++++++++++++++++--
>>>    1 file changed, 22 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
>>> b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
>>> index 85208128f135..93abde467de4 100644
>>> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
>>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
>>> @@ -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);
>> check the return value?
>>> +
>>> +     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,
>>>

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

end of thread, other threads:[~2021-11-11 15:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-11 13:56 [PATCH] net: stmmac: socfpga: add runtime suspend/resume callback for stratix10 platform Meng Li
2021-11-11 14:01 ` Denis Kirjanov
2021-11-11 14:16   ` Li, Meng
2021-11-11 15:02     ` Denis Kirjanov
2021-11-11 14:09 ` Jakub Kicinski

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).