* [PATCH net-next v3] net: mdio: handle broken-turn-around for non-PHY MDIO devices
@ 2026-11-21 19:36 Bastian Germann
2026-11-22 21:27 ` Andrew Lunn
2026-11-25 14:52 ` netdev-bot+sashiko
0 siblings, 2 replies; 3+ messages in thread
From: Bastian Germann @ 2026-11-21 19:36 UTC (permalink / raw)
To: andrew
Cc: hkallweit1, davem, edumazet, kuba, pabeni, linux, olteanv, netdev,
linux-kernel, Signed-off-by: Bastian Germann
From: "Signed-off-by: Bastian Germann" <bage@debian.org>
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 once in __of_mdiobus_parse_phys(), before the PHY and
non-PHY registration paths diverge, 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 | 4 ++++
2 files changed, 4 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..fe321fa16188 100644
--- a/drivers/net/mdio/of_mdio.c
+++ b/drivers/net/mdio/of_mdio.c
@@ -164,6 +164,10 @@ static int __of_mdiobus_parse_phys(struct mii_bus *mdio, struct device_node *np,
continue;
}
+ /* Common to PHYs and other MDIO devices */
+ if (of_property_read_bool(child, "broken-turn-around"))
+ mdio->phy_ignore_ta_mask |= BIT(addr);
+
if (of_mdiobus_child_is_phy(child))
rc = of_mdiobus_register_phy(mdio, child, addr);
else
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v3] net: mdio: handle broken-turn-around for non-PHY MDIO devices
2026-11-21 19:36 [PATCH net-next v3] net: mdio: handle broken-turn-around for non-PHY MDIO devices Bastian Germann
@ 2026-11-22 21:27 ` Andrew Lunn
2026-11-25 14:52 ` netdev-bot+sashiko
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2026-11-22 21:27 UTC (permalink / raw)
To: Bastian Germann
Cc: hkallweit1, davem, edumazet, kuba, pabeni, linux, olteanv, netdev,
linux-kernel
On Sat, Nov 21, 2026 at 08:36:55PM +0100, Bastian Germann wrote:
> From: "Signed-off-by: Bastian Germann" <bage@debian.org>
>
> 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 once in __of_mdiobus_parse_phys(), before the PHY and
> non-PHY registration paths diverge, and drop it from
> fwnode_mdiobus_phy_device_register().
>
> Signed-off-by: Bastian Germann <bage@debian.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v3] net: mdio: handle broken-turn-around for non-PHY MDIO devices
2026-11-21 19:36 [PATCH net-next v3] net: mdio: handle broken-turn-around for non-PHY MDIO devices Bastian Germann
2026-11-22 21:27 ` Andrew Lunn
@ 2026-11-25 14:52 ` netdev-bot+sashiko
1 sibling, 0 replies; 3+ messages in thread
From: netdev-bot+sashiko @ 2026-11-25 14:52 UTC (permalink / raw)
To: bage
Cc: andrew, hkallweit1, davem, edumazet, kuba, pabeni, linux, olteanv,
netdev, linux-kernel
Thank you for your contribution! Sashiko AI review found 6 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 3 · Low: 3
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] Regression on the auto-scan path for PHY nodes that have no
`reg` property.
- [Medium] Regression for PHYs registered through the exported helper
of_mdiobus_phy_device_register() /…
- [Medium] The fix only sets BIT(addr) for the child's `reg` address
(of_mdio.c:169).
- [Low] The patch changes when the mask bit is set for PHYs, and the
commit message only describes the non-PHY fix.
- [Low] The commit author metadata is malformed.
- [Low] The patch fixes a mismatch between binding and implementation.
--
net: mdio: handle broken-turn-around for non-PHY MDIO devices
This patch moves parsing of the "broken-turn-around" DT property out of
fwnode_mdiobus_phy_device_register() and into __of_mdiobus_parse_phys().
The goal is to apply the property to non-PHY MDIO devices such as DSA
switches as well as to PHYs.
[Severity: Low]
This isn't a bug, but the author field of this commit reads:
Author: Signed-off-by: Bastian Germann <bage@debian.org>
Is the "Signed-off-by:" prefix meant to be part of the author name? It
looks like a malformed From: line, and git am would record it as the
author identity.
> 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.
[Severity: Low]
This paragraph describes a mismatch between the mdio.yaml binding and
of_mdiobus_register_device(). Should the commit carry a Fixes: tag, or
say whether it targets net or net-next? Without that, backporters can't
tell where it applies.
> diff --git a/drivers/net/mdio/fwnode_mdio.c b/drivers/net/mdio/fwnode_mdio.c
> index ba70915182654..129481e8a910a 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;
> -
[Severity: Medium]
Does this break broken-turn-around for PHY nodes that have no reg
property?
In __of_mdiobus_parse_phys(), of_mdio_parse_addr() returns a negative
value for such a child. The loop then hits this continue before it
reaches the new check:
addr = of_mdio_parse_addr(&mdio->dev, child);
if (addr < 0) {
/* Skip scanning for invalid ethernet-phy-package node */
if (scanphys)
*scanphys = true;
continue;
}
__of_mdiobus_register() later registers those children from its
auto-scan loop:
if (of_mdiobus_child_is_phy(child)) {
...
rc = of_mdiobus_register_phy(mdio, child, addr);
That call goes through:
of_mdiobus_register_phy()
-> fwnode_mdiobus_register_phy()
-> fwnode_mdiobus_phy_device_register()
The lines removed here were the only place this path set
phy_ignore_ta_mask.
Take a reg-less node with compatible = "ethernet-phy-idXXXX.XXXX" and
broken-turn-around. phy_device_create() registers it without any
register reads, so it worked before this patch.
After this patch, would every later read of that PHY return 0xffff on
mdio-bitbang, or fail on mdio-bcm-unimac and mdio-pic64hpsc?
The commit message says the property is parsed "once in
__of_mdiobus_parse_phys(), before the PHY and non-PHY registration paths
diverge". The auto-scan path never reaches that check, though.
[Severity: Medium]
Can this also drop the property for callers that use the exported
of_mdiobus_phy_device_register() and fwnode_mdiobus_phy_device_register()
helpers without going through __of_mdiobus_parse_phys()?
tja1102_p1_register() in drivers/net/phy/nxp-tja11xx.c walks the children
of the TJA1102 port 0 PHY node and registers port 1 directly:
phy = phy_device_create(bus, addr, PHY_ID_TJA1102, false, NULL);
...
ret = of_mdiobus_phy_device_register(bus, phy, child, addr);
__of_mdiobus_parse_phys() only visits direct children of the bus node
and of ethernet-phy-package nodes, so it never sees this nested node.
ethernet-phy.yaml documents broken-turn-around for every ethernet-phy
node, but after this change it is silently ignored for TJA1102 port 1.
Could the parse stay in fwnode_mdiobus_phy_device_register() as well?
Setting the bit twice is harmless.
> diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c
> index b8d298c04d3ff..fe321fa161888 100644
> --- a/drivers/net/mdio/of_mdio.c
> +++ b/drivers/net/mdio/of_mdio.c
> @@ -164,6 +164,10 @@ static int __of_mdiobus_parse_phys(struct mii_bus *mdio, struct device_node *np,
> continue;
> }
>
> + /* Common to PHYs and other MDIO devices */
> + if (of_property_read_bool(child, "broken-turn-around"))
> + mdio->phy_ignore_ta_mask |= BIT(addr);
[Severity: Medium]
Is masking only the reg address enough for the DSA switches that the
commit message mentions?
Bus drivers check the mask against the address of each transfer. For
example, mdiobb_read_common() does:
!(bus->phy_ignore_ta_mask & (1 << phy))) {
b53_mdio_probe() accepts mdiodev->addr == 0, but b53_mdio_op() sends all
traffic to BRCM_PSEUDO_PHY_ADDR (0x1e):
v = mdiobus_read_nested(bus, BRCM_PSEUDO_PHY_ADDR,
REG_MII_ADDR);
With reg = <0> and broken-turn-around, bit 0 gets set but every access
uses address 30. Wouldn't the busy-poll in b53_mdio_op() still see
0xffff and hit the WARN_ON(i == 5)?
mv88e6xxx in single-chip mode has the same gap. It uses
mv88e6xxx_smi_direct_read(), which calls
mdiobus_read_nested(chip->bus, dev, reg) with port and global block
addresses that differ from reg.
For these switches, would the problem described in the commit message
still be there?
> +
> if (of_mdiobus_child_is_phy(child))
> rc = of_mdiobus_register_phy(mdio, child, addr);
[Severity: Low]
This also changes when the bit gets set for PHYs.
Before, it was set in fwnode_mdiobus_phy_device_register(), after
fwnode_mdiobus_register_phy() had already read the PHY ID:
if (is_c45 || fwnode_get_phy_id(child, &phy_id))
phy = get_phy_device(bus, addr, is_c45);
Now get_phy_device() runs with TA failures ignored. A broken-TA PHY
without an ID compatible may now be detected, where get_phy_device()
used to return -ENODEV.
The bit also stays set for an address whose registration fails in
get_phy_device() or fwnode_find_mii_timestamper().
Is this intended? If so, could the commit message mention the effect on
PHY ID probing?
> else
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261121193655.225520-1-bage%40debian.org
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-25 14:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-21 19:36 [PATCH net-next v3] net: mdio: handle broken-turn-around for non-PHY MDIO devices Bastian Germann
2026-11-22 21:27 ` Andrew Lunn
2026-11-25 14:52 ` netdev-bot+sashiko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox