* [PATCH net-next v2] net: phy: micrel: Make the GPIO to be non-exclusive
@ 2022-08-25 20:14 Horatiu Vultur
2022-08-25 20:16 ` Andrew Lunn
0 siblings, 1 reply; 4+ messages in thread
From: Horatiu Vultur @ 2022-08-25 20:14 UTC (permalink / raw)
To: andrew
Cc: netdev, linux-kernel, hkallweit1, linux, davem, edumazet, kuba,
pabeni, michael, UNGLinuxDriver, maxime.chevallier,
Horatiu Vultur
The same GPIO line can be shared by multiple phys for the coma mode pin.
If that is the case then, all the other phys that share the same line
will failed to be probed because the access to the gpio line is not
non-exclusive.
Fix this by making access to the gpio line to be nonexclusive using flag
GPIOD_FLAGS_BIT_NONEXCLUSIVE. This allows all the other PHYs to be
probed.
Fixes: 738871b09250ee ("net: phy: micrel: add coma mode GPIO")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
v1->v2:
- add comment describing that there should not be anyone putting back
the phy in coma mode.
---
drivers/net/phy/micrel.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index e78d0bf69bc3..6f52b4fb6888 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -2873,12 +2873,18 @@ static int lan8814_config_init(struct phy_device *phydev)
return 0;
}
+/* It is expected that there will not be any 'lan8814_take_coma_mode'
+ * function called in suspend. Because the GPIO line can be shared, so if one of
+ * the phys goes back in coma mode, then all the other PHYs will go, which is
+ * wrong.
+ */
static int lan8814_release_coma_mode(struct phy_device *phydev)
{
struct gpio_desc *gpiod;
gpiod = devm_gpiod_get_optional(&phydev->mdio.dev, "coma-mode",
- GPIOD_OUT_HIGH_OPEN_DRAIN);
+ GPIOD_OUT_HIGH_OPEN_DRAIN |
+ GPIOD_FLAGS_BIT_NONEXCLUSIVE);
if (IS_ERR(gpiod))
return PTR_ERR(gpiod);
--
2.33.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next v2] net: phy: micrel: Make the GPIO to be non-exclusive
2022-08-25 20:14 [PATCH net-next v2] net: phy: micrel: Make the GPIO to be non-exclusive Horatiu Vultur
@ 2022-08-25 20:16 ` Andrew Lunn
2022-08-27 1:37 ` Jakub Kicinski
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Lunn @ 2022-08-25 20:16 UTC (permalink / raw)
To: Horatiu Vultur
Cc: netdev, linux-kernel, hkallweit1, linux, davem, edumazet, kuba,
pabeni, michael, UNGLinuxDriver, maxime.chevallier
On Thu, Aug 25, 2022 at 10:14:47PM +0200, Horatiu Vultur wrote:
> The same GPIO line can be shared by multiple phys for the coma mode pin.
> If that is the case then, all the other phys that share the same line
> will failed to be probed because the access to the gpio line is not
> non-exclusive.
> Fix this by making access to the gpio line to be nonexclusive using flag
> GPIOD_FLAGS_BIT_NONEXCLUSIVE. This allows all the other PHYs to be
> probed.
>
> Fixes: 738871b09250ee ("net: phy: micrel: add coma mode GPIO")
> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next v2] net: phy: micrel: Make the GPIO to be non-exclusive
2022-08-25 20:16 ` Andrew Lunn
@ 2022-08-27 1:37 ` Jakub Kicinski
2022-08-27 6:58 ` Horatiu Vultur
0 siblings, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2022-08-27 1:37 UTC (permalink / raw)
To: Andrew Lunn
Cc: Horatiu Vultur, netdev, linux-kernel, hkallweit1, linux, davem,
edumazet, pabeni, michael, UNGLinuxDriver, maxime.chevallier
On Thu, 25 Aug 2022 22:16:31 +0200 Andrew Lunn wrote:
> On Thu, Aug 25, 2022 at 10:14:47PM +0200, Horatiu Vultur wrote:
> > The same GPIO line can be shared by multiple phys for the coma mode pin.
> > If that is the case then, all the other phys that share the same line
> > will failed to be probed because the access to the gpio line is not
> > non-exclusive.
> > Fix this by making access to the gpio line to be nonexclusive using flag
> > GPIOD_FLAGS_BIT_NONEXCLUSIVE. This allows all the other PHYs to be
> > probed.
> >
> > Fixes: 738871b09250ee ("net: phy: micrel: add coma mode GPIO")
> > Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
>
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
The tree name switch in the subject compared to v1 is unintentional?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next v2] net: phy: micrel: Make the GPIO to be non-exclusive
2022-08-27 1:37 ` Jakub Kicinski
@ 2022-08-27 6:58 ` Horatiu Vultur
0 siblings, 0 replies; 4+ messages in thread
From: Horatiu Vultur @ 2022-08-27 6:58 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Andrew Lunn, netdev, linux-kernel, hkallweit1, linux, davem,
edumazet, pabeni, michael, UNGLinuxDriver, maxime.chevallier
The 08/26/2022 18:37, Jakub Kicinski wrote:
Hi Jakub,
>
> On Thu, 25 Aug 2022 22:16:31 +0200 Andrew Lunn wrote:
> > On Thu, Aug 25, 2022 at 10:14:47PM +0200, Horatiu Vultur wrote:
> > > The same GPIO line can be shared by multiple phys for the coma mode pin.
> > > If that is the case then, all the other phys that share the same line
> > > will failed to be probed because the access to the gpio line is not
> > > non-exclusive.
> > > Fix this by making access to the gpio line to be nonexclusive using flag
> > > GPIOD_FLAGS_BIT_NONEXCLUSIVE. This allows all the other PHYs to be
> > > probed.
> > >
> > > Fixes: 738871b09250ee ("net: phy: micrel: add coma mode GPIO")
> > > Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> >
> > Reviewed-by: Andrew Lunn <andrew@lunn.ch>
>
> The tree name switch in the subject compared to v1 is unintentional?
Yes I have switch it by mistake.
It should be net. I can send a new version if it is needed.
--
/Horatiu
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-08-27 6:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-25 20:14 [PATCH net-next v2] net: phy: micrel: Make the GPIO to be non-exclusive Horatiu Vultur
2022-08-25 20:16 ` Andrew Lunn
2022-08-27 1:37 ` Jakub Kicinski
2022-08-27 6:58 ` Horatiu Vultur
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).