Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: bage@debian.org
Cc: andrew@lunn.ch, hkallweit1@gmail.com, davem@davemloft.net,
	edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
	linux@armlinux.org.uk, olteanv@gmail.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v3] net: mdio: handle broken-turn-around for non-PHY MDIO devices
Date: Wed, 25 Nov 2026 14:52:53 +0000	[thread overview]
Message-ID: <179561837388.3135.1742234801401474384@kernel.org> (raw)
In-Reply-To: <20261121193655.225520-1-bage@debian.org>

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

      parent reply	other threads:[~2026-11-25 14:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179561837388.3135.1742234801401474384@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=bage@debian.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox