devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: "Geert Uytterhoeven" <geert+renesas@glider.be>,
	"David S . Miller" <davem@davemloft.net>,
	"Simon Horman" <horms@verge.net.au>,
	"Magnus Damm" <magnus.damm@gmail.com>,
	"Sergei Shtylyov" <sergei.shtylyov@cogentembedded.com>,
	"Andrew Lunn" <andrew@lunn.ch>,
	"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH 2/4] ravb: Add optional PHY reset during system resume
Date: Thu, 28 Sep 2017 20:45:00 +0200	[thread overview]
Message-ID: <CAMuHMdWOAnT3xONPfU8pJi9fbAgtWL2GyRbooAxrfGDb=bsB_A@mail.gmail.com> (raw)
In-Reply-To: <406f7aff-e386-31f3-39d3-17523443c265@gmail.com>

Hi Florian,

On Thu, Sep 28, 2017 at 7:22 PM, Florian Fainelli <f.fainelli@gmail.com> wrote:
> On 09/28/2017 08:53 AM, Geert Uytterhoeven wrote:
>> If the optional "reset-gpios" property is specified in DT, the generic
>> MDIO bus code takes care of resetting the PHY during device probe.
>> However, the PHY may still have to be reset explicitly after system
>> resume.
>>
>> This allows to restore Ethernet operation after resume from s2ram on
>> Salvator-XS, where the enable pin of the regulator providing PHY power
>> is connected to PRESETn, and PSCI suspend powers down the SoC.
>>
>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> ---
>>  drivers/net/ethernet/renesas/ravb_main.c | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
>> index fdf30bfa403bf416..96d1d48e302f8c9a 100644
>> --- a/drivers/net/ethernet/renesas/ravb_main.c
>> +++ b/drivers/net/ethernet/renesas/ravb_main.c
>> @@ -19,6 +19,7 @@
>>  #include <linux/etherdevice.h>
>>  #include <linux/ethtool.h>
>>  #include <linux/if_vlan.h>
>> +#include <linux/gpio/consumer.h>
>>  #include <linux/kernel.h>
>>  #include <linux/list.h>
>>  #include <linux/module.h>
>> @@ -2268,6 +2269,7 @@ static int __maybe_unused ravb_resume(struct device *dev)
>>  {
>>       struct net_device *ndev = dev_get_drvdata(dev);
>>       struct ravb_private *priv = netdev_priv(ndev);
>> +     struct mii_bus *bus = priv->mii_bus;
>>       int ret = 0;
>>
>>       if (priv->wol_enabled) {
>> @@ -2302,6 +2304,13 @@ static int __maybe_unused ravb_resume(struct device *dev)
>>        * reopen device if it was running before system suspended.
>>        */
>>
>> +     /* PHY reset */
>> +     if (bus->reset_gpiod) {
>> +             gpiod_set_value_cansleep(bus->reset_gpiod, 1);
>> +             udelay(bus->reset_delay_us);
>> +             gpiod_set_value_cansleep(bus->reset_gpiod, 0);
>> +     }
>
> This is a clever hack, but unfortunately this is also misusing the MDIO
> bus reset line into a PHY reset line. As commented in patch 3, if this
> reset line is tied to the PHY, then this should be a PHY property and

OK.

> you cannot (ab)use the MDIO bus GPIO reset logic anymore...

And then I should add reset-gpios support to drivers/net/phy/micrel.c?
Or is there already generic code to handle per-PHY reset? I couldn't find it.

> Should not you also try to manage this reset line during ravb_open() to
> achiever better power savings?

I don't know. The Micrel KSZ9031RNXVA datasheet doesn't mention if it's
safe or not to assert reset for a prolonged time.

Thanks!

Gr{oetje,eeting}s,

                        Geert

  reply	other threads:[~2017-09-28 18:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-28 15:53 [PATCH 0/4] ravb: Add PHY reset support Geert Uytterhoeven
2017-09-28 15:53 ` [PATCH 1/4] dt-bindings: net: ravb: Document optional reset-gpios property Geert Uytterhoeven
2017-09-28 20:07   ` Sergei Shtylyov
2017-10-05 23:24     ` Rob Herring
     [not found] ` <1506614014-4398-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
2017-09-28 15:53   ` [PATCH 2/4] ravb: Add optional PHY reset during system resume Geert Uytterhoeven
2017-09-28 17:22     ` Florian Fainelli
2017-09-28 18:45       ` Geert Uytterhoeven [this message]
2017-09-28 19:21         ` Florian Fainelli
2017-09-30 20:23           ` Sergei Shtylyov
2017-10-01 16:34             ` Florian Fainelli
2017-10-09  9:37               ` Sergei Shtylyov
2017-10-09 12:50                 ` Sergei Shtylyov
2017-09-28 15:53 ` [PATCH 3/4] arm64: dts: renesas: salvator-common: Add EthernetAVB PHY reset Geert Uytterhoeven
     [not found]   ` <1506614014-4398-4-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
2017-09-28 17:20     ` Florian Fainelli
2017-09-28 15:53 ` [PATCH 4/4] arm64: dts: renesas: ulcb: " Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMuHMdWOAnT3xONPfU8pJi9fbAgtWL2GyRbooAxrfGDb=bsB_A@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=geert+renesas@glider.be \
    --cc=horms@verge.net.au \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=sergei.shtylyov@cogentembedded.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).