🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #22592

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

#22592
From: netdev-bot+sashiko
Date: Wed, 25 Nov 2026 14:52
197 lines
15208 bytes
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
Technical Details
Message-ID: <179561837388.3135.1742234801401474384@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371433-linux-kernel-netdev=dewy.ru
References: <20261121193655.225520-1-bage@debian.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371433-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <179561837388.3135.1742234801401474384@kernel.org>
References: <20261121193655.225520-1-bage@debian.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="234231"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:WDQQTbezI/kr71X77xBnzON46Uk= sha256:6DGvpx9ewkZ6jclOHJqHltEtPdIjRKVkaOXCYCxr8fc=
	sha1:bwXpoi/nOpZCaraul6shKLbJfTE= sha256:xmJMZ7oUHirI4IADB1nlI85O52AMqBMbE8uvGCaFbXE=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 618AD125E73; Wed, 25 Nov 2026 17:53:22 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.5
X-Spam-Status: No, score=-3.5 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
	URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id knqxP6wJlt3j;
	Wed, 25 Nov 2026 17:53:18 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-371433-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id A44C5125E74; Wed, 25 Nov 2026 17:53:06 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id B640332512; Wed, 25 Nov 2026 14:53:02 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795618381;
	b=xF73RwouC4TL9whxJI5nwGx8RVUqWlYqUGxi1FOatU76eily8yF6u1KmDjNFYcxOrmm9
	 nDVil5Qgw7fMExVvU+wYcRVaaTZaVSZeMPib1gPJ1/dCo1PvGeoqAxLSgb6QhowN90zwF
	 29SFP7j4MKNqcDDPuG1ZeQv5O1lnJraHbj1a0WciZyfMhILBeBmZUtangeEcqoqfj54YY
	 0qg41wUR5Hmmi3A2KtUx9kZHb+T+qu0NyjTRwRPY/nakSiyYu3ODZjj2KPYWeSwPzy3Ls
	 L7OPVZJVF9s66lu001w9/jSBHFoexcHTdc2qFN+bFRFIPE67ZGfsaczBWysiMC0VneQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795618381;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=CcswUBkdOVJ3jfZCtD7+HEJ8VJztw/DF4w3AKz5CVc8=;
	b=ytYoKdjLzfmaB4rrs3BF2vkwedbrVgf4sbZFZQ4gL8wa5jrDQUSH1pMg0ah6yTn9RFLD
	 Tm3ER6Mdj1pdTabfGbFpeldtORg5rVDsMM9yuTmeKMCVXvolCPwiyiihpnU1ENt5NCw8C
	 ffQ6mXF2p17qU07Yqtbk9n7wJDSvDVyEkzDDblu1vCXv84yPo7tvKSW3FOlVsBGOm0FPQ
	 uDPz9nbc/YMls7ExjLI1okjM3tLMKzLg0nFGqG3RhzwUOABt5/SYqU3CSExZkP0p163iC
	 WE/rAwf+YzAMovVuGZIx6z2K0tpl7yc6EtVlM92raCRC2bBqaJpd1VL9d7JH2bXV6MQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WvF86e0l;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 1351F606A68F;
	Wed, 25 Nov 2026 14:53:01 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WvF86e0l
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795618375;
	b=LYYnOjcWMmZrBFDTjZH2m8wJv6utCUUJHds6WjM5Wsotodq8wSl1m8gHn02N2JCjT+q4
	 EuYCn8mfhg4uvmEZLBVNz+R90lAv9i//ZL9YNptL5hy+ZPuFvBxD2hkAmJNnZ0M7fHJeG
	 62cUHJ/dx9ADjzZ0VhhCxhWDF+jkKi0ihxQFL+WX1A+mKzRHqNzJPDieDpvRFMVa4oVp+
	 aR6jvV0h78I2h7zvbcHRcTiFOvQpqCPtMSqXHwQQ/jkKvcHI4Co9HmM0o0zRnu77lhUMM
	 ouu+NXakHE/+ocUf0XsqvTPRMKbb+YDWH2M1+JW+Cag9WSaQUk+p8KFGW1oYlB30iTg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795618375;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=CcswUBkdOVJ3jfZCtD7+HEJ8VJztw/DF4w3AKz5CVc8=;
	b=sK17IhnZFScH05yHIW4fSFmCawditSHA73RuzMPlXt96gdEBgLMwJWLxGuso/Xh/Jv5t
	 hJw8ePM2yN9/oaIU1Og+RDnu7zF2DIPNx+XnIvif+5T1cj34JWi8Qt9kjZ5ZpCubXpDfj
	 veZ7k99gH+HkC7Q3q4vw+fNeZfg3m5x1Yhv2kNgPeIjqMVtpKoOL8xNe6j1EKAhu6hgzQ
	 rcl0fzfp3frXRiYENHFAU08c+pVDLn9KWPKH+1k3qXfOzm3Oi5dczEQVIpwB048ipL28n
	 7jx6ABEMkGxl9gC+L0wLxAj1DSZ5Xopuu08ZsbQXxO1wkz6AR2jrr3O0PAWztYHw9qQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WvF86e0l;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 353D4606A321;
	Wed, 25 Nov 2026 14:52:55 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 605B31F000D8;
	Wed, 25 Nov 2026 14:52:54 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795618374;
	bh=CcswUBkdOVJ3jfZCtD7+HEJ8VJztw/DF4w3AKz5CVc8=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=WvF86e0loGSlgSCyt5HjzgqYgA6jEFMt27nx6NHaVomCm8lw7FEM8SxDBiVddEvkH
	 lb84Zv/fNTw4s1l1CPV/ExkpUmy8hWWavhOPmlIFWO5qPODypdNPUZJ4ZtWwXi5Kty
	 K0vN9R4ZfCsDW9oaNlxJ32+MZ/0IRS2oGfQaxwa4xZqQwq6qRmoxPPmWOidUipM1Vn
	 0YyVq/HFEElsfl/QsPei2Ls0QDvk++/ifg02Pv6V4+ZicrlQvy45FywFp5XtVgLx7L
	 3KSV6olFS0sFE9OEhNoVK1DUk88YeqwseVf5vsex6Ujgt2OODWA2hHorvuPZIKfhHJ
	 YXdcas1u20V8g==
X-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
X-In-Reply-To: <20261121193655.225520-1-bage@debian.org>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list