diff mbox

[09/10,RFC] ravb: Remove obsolete explicit clock handling for WoL

Message ID 1508162116-5043-10-git-send-email-geert+renesas@glider.be (mailing list archive)
State RFC, archived
Headers show

Commit Message

Geert Uytterhoeven Oct. 16, 2017, 1:55 p.m. UTC
Currently, if Wake-on-LAN is enabled, the EtherAVB device's module clock
is manually kept running during system suspend, to make sure the device
stays active.

Since "soc: renesas: rcar-sysc: Keep wakeup sources active during system
suspend", this workaround is no longer needed.  Hence remove all
explicit clock handling to keep the device active.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This must not be applied before the dependency has landed upstream,
hence the "RFC"!
---
 drivers/net/ethernet/renesas/ravb_main.c | 8 --------
 1 file changed, 8 deletions(-)

Comments

Niklas Söderlund Oct. 16, 2017, 3:14 p.m. UTC | #1
Hi Geert,

On 2017-10-16 15:55:15 +0200, Geert Uytterhoeven wrote:
> Currently, if Wake-on-LAN is enabled, the EtherAVB device's module clock
> is manually kept running during system suspend, to make sure the device
> stays active.
> 
> Since "soc: renesas: rcar-sysc: Keep wakeup sources active during system
> suspend", this workaround is no longer needed.  Hence remove all
> explicit clock handling to keep the device active.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
> This must not be applied before the dependency has landed upstream,
> hence the "RFC"!
> ---
>  drivers/net/ethernet/renesas/ravb_main.c | 8 --------
>  1 file changed, 8 deletions(-)
> 
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index fdf30bfa403bf416..11ffccca11d56df5 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -2218,9 +2218,6 @@ static int ravb_wol_setup(struct net_device *ndev)
>  	/* Enable MagicPacket */
>  	ravb_modify(ndev, ECMR, ECMR_MPDE, ECMR_MPDE);
>  
> -	/* Increased clock usage so device won't be suspended */
> -	clk_enable(priv->clk);
> -
>  	return enable_irq_wake(priv->emac_irq);
>  }
>  
> @@ -2239,9 +2236,6 @@ static int ravb_wol_restore(struct net_device *ndev)
>  	if (ret < 0)
>  		return ret;
>  
> -	/* Restore clock usage count */
> -	clk_disable(priv->clk);
> -
>  	return disable_irq_wake(priv->emac_irq);
>  }
>  
> @@ -2289,8 +2283,6 @@ static int __maybe_unused ravb_resume(struct device *dev)
>  		 *       this clock dance should be removed.
>  		 */
>  		clk_disable(priv->clk);
> -		clk_disable(priv->clk);
> -		clk_enable(priv->clk);
>  		clk_enable(priv->clk);
>  
>  		/* Set reset mode to rearm the WoL logic */
> -- 
> 2.7.4
>
Sergei Shtylyov Oct. 16, 2017, 8:17 p.m. UTC | #2
On 10/16/2017 04:55 PM, Geert Uytterhoeven wrote:

> Currently, if Wake-on-LAN is enabled, the EtherAVB device's module clock
> is manually kept running during system suspend, to make sure the device
> stays active.
> 
> Since "soc: renesas: rcar-sysc: Keep wakeup sources active during system
> suspend", this workaround is no longer needed.  Hence remove all
> explicit clock handling to keep the device active.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
[...]

Reviewed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index fdf30bfa403bf416..11ffccca11d56df5 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
[...]
> @@ -2289,8 +2283,6 @@ static int __maybe_unused ravb_resume(struct device *dev)
>   		 *       this clock dance should be removed.
>   		 */
>   		clk_disable(priv->clk);
> -		clk_disable(priv->clk);
> -		clk_enable(priv->clk);
>   		clk_enable(priv->clk);

    I thought the entire clock dance could be removed now? Not yet?

[...]

MBR, Sergei
Geert Uytterhoeven Oct. 17, 2017, 7:10 a.m. UTC | #3
Hi Sergei,

On Mon, Oct 16, 2017 at 10:17 PM, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
> On 10/16/2017 04:55 PM, Geert Uytterhoeven wrote:
>> Currently, if Wake-on-LAN is enabled, the EtherAVB device's module clock
>> is manually kept running during system suspend, to make sure the device
>> stays active.
>>
>> Since "soc: renesas: rcar-sysc: Keep wakeup sources active during system
>> suspend", this workaround is no longer needed.  Hence remove all
>> explicit clock handling to keep the device active.
>>
>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>
> [...]
>
> Reviewed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>
>> diff --git a/drivers/net/ethernet/renesas/ravb_main.c
>> b/drivers/net/ethernet/renesas/ravb_main.c
>> index fdf30bfa403bf416..11ffccca11d56df5 100644
>> --- a/drivers/net/ethernet/renesas/ravb_main.c
>> +++ b/drivers/net/ethernet/renesas/ravb_main.c
>
> [...]
>>
>> @@ -2289,8 +2283,6 @@ static int __maybe_unused ravb_resume(struct device
>> *dev)
>>                  *       this clock dance should be removed.
>>                  */
>>                 clk_disable(priv->clk);
>> -               clk_disable(priv->clk);
>> -               clk_enable(priv->clk);
>>                 clk_enable(priv->clk);
>
>
>    I thought the entire clock dance could be removed now? Not yet?

The remaining clock dance steps work around PSCI powering down the SoC,
after which the hardware and Linux disagree about the clock state.
They can be removed after "[PATCH v3 0/5] clk: renesas: rcar-gen3: Restore
clocks during resume" has hit upstream.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
diff mbox

Patch

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index fdf30bfa403bf416..11ffccca11d56df5 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -2218,9 +2218,6 @@  static int ravb_wol_setup(struct net_device *ndev)
 	/* Enable MagicPacket */
 	ravb_modify(ndev, ECMR, ECMR_MPDE, ECMR_MPDE);
 
-	/* Increased clock usage so device won't be suspended */
-	clk_enable(priv->clk);
-
 	return enable_irq_wake(priv->emac_irq);
 }
 
@@ -2239,9 +2236,6 @@  static int ravb_wol_restore(struct net_device *ndev)
 	if (ret < 0)
 		return ret;
 
-	/* Restore clock usage count */
-	clk_disable(priv->clk);
-
 	return disable_irq_wake(priv->emac_irq);
 }
 
@@ -2289,8 +2283,6 @@  static int __maybe_unused ravb_resume(struct device *dev)
 		 *       this clock dance should be removed.
 		 */
 		clk_disable(priv->clk);
-		clk_disable(priv->clk);
-		clk_enable(priv->clk);
 		clk_enable(priv->clk);
 
 		/* Set reset mode to rearm the WoL logic */