[PATCH net-next v3] net: mdio: handle broken-turn-around for non-PHY MDIO devices

Bastian Germann posted 1 patch 1 day, 13 hours ago
drivers/net/mdio/fwnode_mdio.c | 3 ---
drivers/net/mdio/of_mdio.c     | 4 ++++
2 files changed, 4 insertions(+), 3 deletions(-)
[PATCH net-next v3] net: mdio: handle broken-turn-around for non-PHY MDIO devices
Posted by Bastian Germann 1 day, 13 hours ago
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
Re: [PATCH net-next v3] net: mdio: handle broken-turn-around for non-PHY MDIO devices
Posted by Andrew Lunn 11 hours ago
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