* [PATCH] macb: fix PHY reset
@ 2016-03-22 19:27 Sergei Shtylyov
2016-03-22 19:34 ` Sergei Shtylyov
0 siblings, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2016-03-22 19:27 UTC (permalink / raw)
To: netdev, nicolas.ferre
The driver calls gpiod_set_value() with GPIOD_OUT_* instead of 0 and 1, as
a result the PHY isn't really put back into reset state in macb_remove().
Moreover, the driver assumes that something else has set the GPIO direction
to output, so if it has not, the PHY wouldn't be taken out of reset in
macb_probe() either...
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
The patch is against David Miller's 'net.git' repo.
drivers/net/ethernet/cadence/macb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: net/drivers/net/ethernet/cadence/macb.c
===================================================================
--- net.orig/drivers/net/ethernet/cadence/macb.c
+++ net/drivers/net/ethernet/cadence/macb.c
@@ -2959,7 +2959,7 @@ static int macb_probe(struct platform_de
int gpio = of_get_named_gpio(phy_node, "reset-gpios", 0);
if (gpio_is_valid(gpio))
bp->reset_gpio = gpio_to_desc(gpio);
- gpiod_set_value(bp->reset_gpio, GPIOD_OUT_HIGH);
+ gpiod_direction_output(bp->reset_gpio, 1);
}
of_node_put(phy_node);
@@ -3029,7 +3029,7 @@ static int macb_remove(struct platform_d
mdiobus_free(bp->mii_bus);
/* Shutdown the PHY if there is a GPIO reset */
- gpiod_set_value(bp->reset_gpio, GPIOD_OUT_LOW);
+ gpiod_set_value(bp->reset_gpio, 0);
unregister_netdev(dev);
clk_disable_unprepare(bp->tx_clk);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] macb: fix PHY reset
2016-03-22 19:27 [PATCH] macb: fix PHY reset Sergei Shtylyov
@ 2016-03-22 19:34 ` Sergei Shtylyov
2016-03-22 20:07 ` David Miller
0 siblings, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2016-03-22 19:34 UTC (permalink / raw)
To: netdev, nicolas.ferre
On 03/22/2016 10:27 PM, Sergei Shtylyov wrote:
> The driver calls gpiod_set_value() with GPIOD_OUT_* instead of 0 and 1, as
> a result the PHY isn't really put back into reset state in macb_remove().
> Moreover, the driver assumes that something else has set the GPIO direction
> to output, so if it has not, the PHY wouldn't be taken out of reset in
s/wouldn't/may not/, sorry. Do I need to resend?
> macb_probe() either...
>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
MBR, Sergei
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] macb: fix PHY reset
2016-03-22 19:34 ` Sergei Shtylyov
@ 2016-03-22 20:07 ` David Miller
2016-03-22 21:04 ` Sergei Shtylyov
2016-03-22 21:33 ` Sergei Shtylyov
0 siblings, 2 replies; 6+ messages in thread
From: David Miller @ 2016-03-22 20:07 UTC (permalink / raw)
To: sergei.shtylyov; +Cc: netdev, nicolas.ferre
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date: Tue, 22 Mar 2016 22:34:05 +0300
> On 03/22/2016 10:27 PM, Sergei Shtylyov wrote:
>
>> The driver calls gpiod_set_value() with GPIOD_OUT_* instead of 0 and
>> 1, as
>> a result the PHY isn't really put back into reset state in
>> macb_remove().
>> Moreover, the driver assumes that something else has set the GPIO
>> direction
>> to output, so if it has not, the PHY wouldn't be taken out of reset in
>
> s/wouldn't/may not/, sorry. Do I need to resend?
No need, I fixed it up by hand.
Applied, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] macb: fix PHY reset
2016-03-22 20:07 ` David Miller
@ 2016-03-22 21:04 ` Sergei Shtylyov
2016-03-22 21:33 ` Sergei Shtylyov
1 sibling, 0 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2016-03-22 21:04 UTC (permalink / raw)
To: David Miller; +Cc: netdev, nicolas.ferre
On 03/22/2016 11:07 PM, David Miller wrote:
>>> The driver calls gpiod_set_value() with GPIOD_OUT_* instead of 0 and
>>> 1, as
>>> a result the PHY isn't really put back into reset state in
>>> macb_remove().
>>> Moreover, the driver assumes that something else has set the GPIO
>>> direction
>>> to output, so if it has not, the PHY wouldn't be taken out of reset in
>>
>> s/wouldn't/may not/, sorry. Do I need to resend?
>
> No need, I fixed it up by hand.
>
> Applied, thanks.
Thank you! gpio_request() or smth of that sort wouldn't hurt too (the pin
won't be switched to the GPIO mode on the pin function controller that I have
here...
Anyway, this code is doomed if my phylib reset GPIO patch (to be posted
yet) is accepted ...
MBR, Sergei
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] macb: fix PHY reset
2016-03-22 20:07 ` David Miller
2016-03-22 21:04 ` Sergei Shtylyov
@ 2016-03-22 21:33 ` Sergei Shtylyov
2016-03-23 8:54 ` Nicolas Ferre
1 sibling, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2016-03-22 21:33 UTC (permalink / raw)
To: David Miller; +Cc: netdev, nicolas.ferre
On 03/22/2016 11:07 PM, David Miller wrote:
>> On 03/22/2016 10:27 PM, Sergei Shtylyov wrote:
>>
>>> The driver calls gpiod_set_value() with GPIOD_OUT_* instead of 0 and
>>> 1, as
>>> a result the PHY isn't really put back into reset state in
>>> macb_remove().
>>> Moreover, the driver assumes that something else has set the GPIO
>>> direction
>>> to output, so if it has not, the PHY wouldn't be taken out of reset in
>>
>> s/wouldn't/may not/, sorry. Do I need to resend?
>
> No need, I fixed it up by hand.
>
> Applied, thanks.
Oops, forgot another tag:
Fixes: 270c499f0993 ("net/macb: Update device tree binding for resetting PHY
using GPIO")
Too late probably... :-(
MBR, Sergei
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] macb: fix PHY reset
2016-03-22 21:33 ` Sergei Shtylyov
@ 2016-03-23 8:54 ` Nicolas Ferre
0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Ferre @ 2016-03-23 8:54 UTC (permalink / raw)
To: Sergei Shtylyov, David Miller; +Cc: netdev
Le 22/03/2016 22:33, Sergei Shtylyov a écrit :
> On 03/22/2016 11:07 PM, David Miller wrote:
>
>>> On 03/22/2016 10:27 PM, Sergei Shtylyov wrote:
>>>
>>>> The driver calls gpiod_set_value() with GPIOD_OUT_* instead of 0 and
>>>> 1, as
>>>> a result the PHY isn't really put back into reset state in
>>>> macb_remove().
>>>> Moreover, the driver assumes that something else has set the GPIO
>>>> direction
>>>> to output, so if it has not, the PHY wouldn't be taken out of reset in
>>>
>>> s/wouldn't/may not/, sorry. Do I need to resend?
>>
>> No need, I fixed it up by hand.
>>
>> Applied, thanks.
>
> Oops, forgot another tag:
>
> Fixes: 270c499f0993 ("net/macb: Update device tree binding for resetting PHY
> using GPIO")
>
> Too late probably... :-(
Too late also:
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Thanks Sergei!
Bye,
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-03-23 8:54 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-22 19:27 [PATCH] macb: fix PHY reset Sergei Shtylyov
2016-03-22 19:34 ` Sergei Shtylyov
2016-03-22 20:07 ` David Miller
2016-03-22 21:04 ` Sergei Shtylyov
2016-03-22 21:33 ` Sergei Shtylyov
2016-03-23 8:54 ` Nicolas Ferre
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.