From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Geert Uytterhoeven <geert+renesas@glider.be>,
"David S . Miller" <davem@davemloft.net>,
Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Simon Horman <horms@verge.net.au>,
Magnus Damm <magnus.damm@gmail.com>
Cc: Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
Richard Leitner <richard.leitner@skidata.com>,
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4.1] phylib: Add device reset GPIO support
Date: Thu, 7 Dec 2017 20:40:37 +0300 [thread overview]
Message-ID: <7019d8c1-4444-e981-b2fb-7fefde4a34be@cogentembedded.com> (raw)
In-Reply-To: <69fe9a6d-4039-6f80-b80d-7dc0de31e5bf@cogentembedded.com>
On 12/07/2017 08:20 PM, Sergei Shtylyov wrote:
>> The PHY devices sometimes do have their reset signal (maybe even power
>> supply?) tied to some GPIO and sometimes it also does happen that a boot
>> loader does not leave it deasserted. So far this issue has been attacked
>> from (as I believe) a wrong angle: by teaching the MAC driver to manipulate
>> the GPIO in question; that solution, when applied to the device trees, led
>> to adding the PHY reset GPIO properties to the MAC device node, with one
>> exception: Cadence MACB driver which could handle the "reset-gpios" prop
>> in a PHY device subnode. I believe that the correct approach is to teach
>> the 'phylib' to get the MDIO device reset GPIO from the device tree node
>> corresponding to this device -- which this patch is doing...
>>
>> Note that I had to modify the AT803x PHY driver as it would stop working
>> otherwise -- it made use of the reset GPIO for its own purposes...
>>
>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>> Acked-by: Rob Herring <robh@kernel.org>
>> [geert: Propagate actual errors from fwnode_get_named_gpiod()]
>> [geert: Avoid destroying initial setup]
>> [geert: Consolidate GPIO descriptor acquiring code]
>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> [...]
>> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
>> index 2df7b62c1a36811e..8f8b7747c54bc478 100644
>> --- a/drivers/net/phy/mdio_bus.c
>> +++ b/drivers/net/phy/mdio_bus.c
> [...]
>> @@ -48,9 +49,26 @@
>> int mdiobus_register_device(struct mdio_device *mdiodev)
>> {
>> + struct gpio_desc *gpiod = NULL;
>> +
>> if (mdiodev->bus->mdio_map[mdiodev->addr])
>> return -EBUSY;
>> + /* Deassert the optional reset signal */
>
> Umm, but why deassert it here for such a short time?
>
>> + if (mdiodev->dev.of_node)
>> + gpiod = fwnode_get_named_gpiod(&mdiodev->dev.of_node->fwnode,
>> + "reset-gpios", 0, GPIOD_OUT_LOW,
>> + "PHY reset");
>> + if (PTR_ERR(gpiod) == -ENOENT)
>> + gpiod = NULL;
>> + else if (IS_ERR(gpiod))
>> + return PTR_ERR(gpiod);
>
> Hm, returning on error with reset deasserted?
Oops, error means we couldn't drive the GPIO at all...
The 1st question remains though...
[...]
MBR, Sergei
next prev parent reply other threads:[~2017-12-07 17:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-04 10:34 [PATCH v4 0/4] Teach phylib hard-resetting devices Geert Uytterhoeven
2017-12-04 10:34 ` [PATCH v4 1/4] phylib: Add device reset GPIO support Geert Uytterhoeven
2017-12-04 12:35 ` [PATCH v4.1] " Geert Uytterhoeven
2017-12-04 16:20 ` Richard Leitner
2017-12-07 17:20 ` Sergei Shtylyov
2017-12-07 17:40 ` Sergei Shtylyov [this message]
2017-12-08 9:53 ` Geert Uytterhoeven
2017-12-08 17:20 ` Sergei Shtylyov
2017-12-04 10:34 ` [PATCH v4 2/4] macb: Kill PHY reset code Geert Uytterhoeven
2017-12-04 10:34 ` [PATCH v4 3/4] arm64: dts: renesas: salvator-common: Add EthernetAVB PHY reset Geert Uytterhoeven
2017-12-04 10:34 ` [PATCH v4 4/4] arm64: dts: renesas: ulcb: " Geert Uytterhoeven
2017-12-05 17:51 ` [PATCH v4 0/4] Teach phylib hard-resetting devices David Miller
2017-12-11 7:04 ` Simon Horman
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=7019d8c1-4444-e981-b2fb-7fefde4a34be@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--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-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=mark.rutland@arm.com \
--cc=netdev@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=richard.leitner@skidata.com \
--cc=robh+dt@kernel.org \
/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
all inboxes | Powered by JetHome®