* [PATCH] net: phy: allow for reset line to be tied to a sleepy GPIO controller
@ 2019-10-04 13:53 Andrea Merello
2019-10-04 14:04 ` Andrew Lunn
2019-10-05 1:08 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Andrea Merello @ 2019-10-04 13:53 UTC (permalink / raw)
To: andrew, f.fainelli, hkallweit1, davem; +Cc: netdev, Andrea Merello
mdio_device_reset() makes use of the atomic-pretending API flavor for
handling the PHY reset GPIO line.
I found no hint that mdio_device_reset() is called from atomic context
and indeed it uses usleep_range() since long time, so I would assume that
it is OK to sleep there.
This patch switch to gpiod_set_value_cansleep() in mdio_device_reset().
This is relevant if e.g. the PHY reset line is tied to a I2C GPIO
controller.
This has been tested on a ZynqMP board running an upstream 4.19 kernel and
then hand-ported on current kernel tree.
Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
---
drivers/net/phy/mdio_device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/phy/mdio_device.c b/drivers/net/phy/mdio_device.c
index e282600bd83e..c1d345c3cab3 100644
--- a/drivers/net/phy/mdio_device.c
+++ b/drivers/net/phy/mdio_device.c
@@ -121,7 +121,7 @@ void mdio_device_reset(struct mdio_device *mdiodev, int value)
return;
if (mdiodev->reset_gpio)
- gpiod_set_value(mdiodev->reset_gpio, value);
+ gpiod_set_value_cansleep(mdiodev->reset_gpio, value);
if (mdiodev->reset_ctrl) {
if (value)
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: phy: allow for reset line to be tied to a sleepy GPIO controller
2019-10-04 13:53 [PATCH] net: phy: allow for reset line to be tied to a sleepy GPIO controller Andrea Merello
@ 2019-10-04 14:04 ` Andrew Lunn
2019-10-05 1:08 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2019-10-04 14:04 UTC (permalink / raw)
To: Andrea Merello; +Cc: f.fainelli, hkallweit1, davem, netdev
On Fri, Oct 04, 2019 at 03:53:32PM +0200, Andrea Merello wrote:
> mdio_device_reset() makes use of the atomic-pretending API flavor for
> handling the PHY reset GPIO line.
>
> I found no hint that mdio_device_reset() is called from atomic context
> and indeed it uses usleep_range() since long time, so I would assume that
> it is OK to sleep there.
>
> This patch switch to gpiod_set_value_cansleep() in mdio_device_reset().
> This is relevant if e.g. the PHY reset line is tied to a I2C GPIO
> controller.
>
> This has been tested on a ZynqMP board running an upstream 4.19 kernel and
> then hand-ported on current kernel tree.
>
> Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
Yes, all the other bits of code using GPIOs are using the _cansleep
versions.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: phy: allow for reset line to be tied to a sleepy GPIO controller
2019-10-04 13:53 [PATCH] net: phy: allow for reset line to be tied to a sleepy GPIO controller Andrea Merello
2019-10-04 14:04 ` Andrew Lunn
@ 2019-10-05 1:08 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-10-05 1:08 UTC (permalink / raw)
To: andrea.merello; +Cc: andrew, f.fainelli, hkallweit1, netdev
From: Andrea Merello <andrea.merello@gmail.com>
Date: Fri, 4 Oct 2019 15:53:32 +0200
> mdio_device_reset() makes use of the atomic-pretending API flavor for
> handling the PHY reset GPIO line.
>
> I found no hint that mdio_device_reset() is called from atomic context
> and indeed it uses usleep_range() since long time, so I would assume that
> it is OK to sleep there.
>
> This patch switch to gpiod_set_value_cansleep() in mdio_device_reset().
> This is relevant if e.g. the PHY reset line is tied to a I2C GPIO
> controller.
>
> This has been tested on a ZynqMP board running an upstream 4.19 kernel and
> then hand-ported on current kernel tree.
>
> Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-05 1:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-04 13:53 [PATCH] net: phy: allow for reset line to be tied to a sleepy GPIO controller Andrea Merello
2019-10-04 14:04 ` Andrew Lunn
2019-10-05 1:08 ` David Miller
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).