* [PATCH net-next v2] net: mdio: handle broken-turn-around for non-PHY MDIO devices
@ 2026-11-21 9:29 Bastian Germann
2026-11-21 17:06 ` Andrew Lunn
0 siblings, 1 reply; 4+ messages in thread
From: Bastian Germann @ 2026-11-21 9:29 UTC (permalink / raw)
To: andrew
Cc: hkallweit1, davem, edumazet, kuba, pabeni, linux, olteanv,
netdev, linux-kernel, Bastian Germann
The "broken-turn-around" property is documented in mdio.yaml for any
MDIO device, but the MDIO core currently parses it only for PHY devices
in fwnode_mdiobus_phy_device_register(). Non-PHY devices, such as DSA
switches, are registered through of_mdiobus_register_device(), where the
property is ignored, so MDIO bus drivers that rely on phy_ignore_ta_mask
still treat the turn-around/read failure as an error.
Parse the property in of_mdiobus_register_phy() and
of_mdiobus_register_device() instead, so it is handled in one place for
both PHYs and other MDIO devices, and drop it from
fwnode_mdiobus_phy_device_register().
Signed-off-by: Bastian Germann <bage@debian.org>
---
drivers/net/mdio/fwnode_mdio.c | 3 ---
drivers/net/mdio/of_mdio.c | 6 ++++++
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/net/mdio/fwnode_mdio.c b/drivers/net/mdio/fwnode_mdio.c
index ba7091518265..129481e8a910 100644
--- a/drivers/net/mdio/fwnode_mdio.c
+++ b/drivers/net/mdio/fwnode_mdio.c
@@ -89,9 +89,6 @@ int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio,
phy->irq = mdio->irq[addr];
}
- if (fwnode_property_read_bool(child, "broken-turn-around"))
- mdio->phy_ignore_ta_mask |= 1 << addr;
-
/* Associate the fwnode with the device structure so it
* can be looked up later
*/
diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c
index b8d298c04d3f..c03fcf34b3a6 100644
--- a/drivers/net/mdio/of_mdio.c
+++ b/drivers/net/mdio/of_mdio.c
@@ -46,6 +46,9 @@ EXPORT_SYMBOL(of_mdiobus_phy_device_register);
static int of_mdiobus_register_phy(struct mii_bus *mdio,
struct device_node *child, u32 addr)
{
+ if (of_property_read_bool(child, "broken-turn-around"))
+ mdio->phy_ignore_ta_mask |= BIT(addr);
+
return fwnode_mdiobus_register_phy(mdio, of_fwnode_handle(child), addr);
}
@@ -56,6 +59,9 @@ static int of_mdiobus_register_device(struct mii_bus *mdio,
struct mdio_device *mdiodev;
int rc;
+ if (fwnode_property_read_bool(fwnode, "broken-turn-around"))
+ mdio->phy_ignore_ta_mask |= BIT(addr);
+
mdiodev = mdio_device_create(mdio, addr);
if (IS_ERR(mdiodev))
return PTR_ERR(mdiodev);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next v2] net: mdio: handle broken-turn-around for non-PHY MDIO devices
2026-11-21 9:29 [PATCH net-next v2] net: mdio: handle broken-turn-around for non-PHY MDIO devices Bastian Germann
@ 2026-11-21 17:06 ` Andrew Lunn
2026-11-21 19:07 ` Bastian Germann
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Lunn @ 2026-11-21 17:06 UTC (permalink / raw)
To: Bastian Germann
Cc: hkallweit1, davem, edumazet, kuba, pabeni, linux, olteanv,
netdev, linux-kernel
> Parse the property in of_mdiobus_register_phy() and
> of_mdiobus_register_device() instead, so it is handled in one place for
> both PHYs and other MDIO devices, and drop it from
> fwnode_mdiobus_phy_device_register().
This seems odd. "handled in one place", yet you do it in two?
Is there a reason not to do it in __of_mdiobus_parse_phys() ?
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next v2] net: mdio: handle broken-turn-around for non-PHY MDIO devices
2026-11-21 17:06 ` Andrew Lunn
@ 2026-11-21 19:07 ` Bastian Germann
2026-11-21 19:28 ` Andrew Lunn
0 siblings, 1 reply; 4+ messages in thread
From: Bastian Germann @ 2026-11-21 19:07 UTC (permalink / raw)
To: Andrew Lunn
Cc: hkallweit1, davem, edumazet, kuba, pabeni, linux, olteanv,
netdev, linux-kernel
Hi Andrew,
On 11/21/26 18:06, Andrew Lunn wrote:
>> Parse the property in of_mdiobus_register_phy() and
>> of_mdiobus_register_device() instead, so it is handled in one place for
>> both PHYs and other MDIO devices, and drop it from
>> fwnode_mdiobus_phy_device_register().
> This seems odd. "handled in one place", yet you do it in two?
>
> Is there a reason not to do it in __of_mdiobus_parse_phys() ?
Yes. My v2 draft was exactly that (which is the reason for the commit
message oddity) but I noticed that children with empty reg that are
handled in the auto-scan loop would then not get the bit mask set, which
is an unnecessary behavior change for PHYs. I will send a v3 with your
proposal. I am happy with either of them.
Thanks,
Bastian
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next v2] net: mdio: handle broken-turn-around for non-PHY MDIO devices
2026-11-21 19:07 ` Bastian Germann
@ 2026-11-21 19:28 ` Andrew Lunn
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2026-11-21 19:28 UTC (permalink / raw)
To: Bastian Germann
Cc: hkallweit1, davem, edumazet, kuba, pabeni, linux, olteanv,
netdev, linux-kernel
On Sat, Nov 21, 2026 at 08:07:34PM +0100, Bastian Germann wrote:
> Hi Andrew,
>
> On 11/21/26 18:06, Andrew Lunn wrote:
> > > Parse the property in of_mdiobus_register_phy() and
> > > of_mdiobus_register_device() instead, so it is handled in one place for
> > > both PHYs and other MDIO devices, and drop it from
> > > fwnode_mdiobus_phy_device_register().
> > This seems odd. "handled in one place", yet you do it in two?
> >
> > Is there a reason not to do it in __of_mdiobus_parse_phys() ?
>
> Yes. My v2 draft was exactly that (which is the reason for the commit
> message oddity) but I noticed that children with empty reg that are handled
> in the auto-scan loop would then not get the bit mask set, which is an
> unnecessary behavior change for PHYs.
Ah, O.K. I never liked that scan code filling in missing devices. It
has a warning not to do that. So i don't know if it is actually used.
Also, i could not find any in kernel dt blobs using
broken-turn-around. So we are not going to break anything.
Andrew
---
pw-bot: cr
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-21 19:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-21 9:29 [PATCH net-next v2] net: mdio: handle broken-turn-around for non-PHY MDIO devices Bastian Germann
2026-11-21 17:06 ` Andrew Lunn
2026-11-21 19:07 ` Bastian Germann
2026-11-21 19:28 ` Andrew Lunn
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®