🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #21359

Re: [PATCH net-next v2 2/2] net: hix5hd2_gmac: support fixed-link and mdio child

#21359
From: netdev-bot+sashiko
Date: Mon, 23 Nov 2026 23:02
189 lines
14147 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

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] In hix5hd2_dev_probe()
  (drivers/net/ethernet/hisilicon/hix5hd2_gmac.c), the MDIO bus is now…
- [Low] hix5hd2_dev_probe() now uses of_phy_is_fixed_link(node) to choose
  between the fixed-link path and the phy-handle path, and also to…

--

net: hix5hd2_gmac: support fixed-link and mdio child

This commit adds fixed-link support to hix5hd2_gmac. With it, the MAC can
probe when it is wired directly to another MAC with no PHY. It also
registers the MDIO bus on an "mdio" child node when one is present. When
the MAC node has a fixed-link and no mdio child, it skips the MDIO bus
entirely.

> diff --git a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
> index 12a5657653f85..9a2a3fa1455fb 100644
> --- a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
> +++ b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c

[ ... ]

> @@ -1175,23 +1176,35 @@ static int hix5hd2_dev_probe(struct platform_device *pdev)
>  		hix5hd2_phy_reset(priv);
>  	}
>  

[ ... ]

> +	bus = NULL;
> +	mdio_np = of_get_child_by_name(node, "mdio");
> +	if (mdio_np || !of_phy_is_fixed_link(node)) {
> +		bus = mdiobus_alloc();
> +		if (!bus) {
> +			ret = -ENOMEM;
> +			of_node_put(mdio_np);
> +			goto out_disable_clk;
> +		}

[Severity: Medium]
In hix5hd2_dev_probe(), if the MAC node has a fixed-link but no "mdio"
child, this condition is false. mdiobus_alloc() and of_mdiobus_register()
are never called, and bus and priv->bus stay NULL.

Are MDIO devices described as direct children of the MAC node then
silently ignored?

The binding from the preceding patch ("dt-bindings: net:
hisilicon,hisi-gmac-v1: allow fixed-link and mdio child") still says this
for the mdio property:

    Node containing PHY children. If this node is not present, then PHYs
    will be direct children.

The binding also still references mdio.yaml at the MAC node level. So a
fixed-link node with direct <name>@<addr> MDIO children looks
binding-valid. Examples would be a PHY used by another MAC, or a switch
managed over this GMAC's MDIO lines. In that case nothing is probed and
no warning is printed.

Separately, the commit message says:

    Register the bus based on if the PHY attached to a given interface is
    described in the device tree or not, like commit ef8a2e27289e ("net:
    macb: fix probing of PHY not described in the dt").

Is that accurate? macb_mdiobus_register() always registers the bus. It
only chooses between DT-based and scan-based registration:

drivers/net/ethernet/cadence/macb_main.c:macb_mdiobus_register() {
    ...
	for_each_available_child_of_node(np, child)
		if (of_mdiobus_child_is_phy(child)) {
			of_node_put(child);
			return of_mdiobus_register(bp->mii_bus, np);
		}

	return mdiobus_register(bp->mii_bus);
}

Also, of_mdiobus_child_is_phy() returns true for any child that has no
compatible property:

drivers/net/mdio/of_mdio.c:of_mdiobus_child_is_phy() {
    ...
	if (!of_property_present(child, "compatible"))
		return true;
    ...
}

Under the macb logic, the fixed-link subnode would therefore still count
as a PHY. of_mdiobus_register(np) would still run and print the "scan phy
fixed-link at address X" messages.

The code here takes a different approach: it registers no bus at all for
fixed-link. Could the commit message describe what the code does instead?

The commit message also doesn't mention that an "mdio" child is now used
as the bus node. Before this patch it was scanned as a reg-less PHY
candidate of the MAC node.

[ ... ]

> @@ -1199,11 +1212,18 @@ static int hix5hd2_dev_probe(struct platform_device *pdev)
>  		goto err_mdiobus;
>  	}
>  
> -	priv->phy_node = of_parse_phandle(node, "phy-handle", 0);
> -	if (!priv->phy_node) {
> -		netdev_err(ndev, "not find phy-handle\n");
> -		ret = -EINVAL;
> -		goto err_mdiobus;
> +	if (of_phy_is_fixed_link(node)) {
> +		ret = of_phy_register_fixed_link(node);
> +		if (ret < 0)
> +			goto err_mdiobus;
> +		priv->phy_node = of_node_get(node);
> +	} else {
> +		priv->phy_node = of_parse_phandle(node, "phy-handle", 0);

[Severity: Low]
of_phy_is_fixed_link() also returns true when the node sets managed to
anything other than "auto". This happens even with no fixed-link property
or subnode:

drivers/net/mdio/of_mdio.c:of_phy_is_fixed_link() {
    ...
	err = of_property_read_string(np, "managed", &managed);
	if (err == 0 && strcmp(managed, "auto") != 0)
		return true;
    ...
}

What happens to a node with managed = "in-band-status", a phy-handle and
no mdio child? Before this patch the driver ignored managed and connected
the real PHY through phy-handle.

After this patch:

- no MDIO bus is registered, because of the bus condition above
- phy-handle is never parsed
- of_phy_register_fixed_link() takes the in-band-status path:

drivers/net/mdio/of_mdio.c:of_phy_register_fixed_link() {
    ...
	if (of_property_read_string(np, "managed", &managed) == 0 &&
	    strcmp(managed, "in-band-status") == 0) {
		/* status is zeroed, namely its .link member */
		goto register_phy;
	}
    ...
}

hix5hd2 has no PCS or in-band status handling, so nothing ever sets the
fixed PHY's link. Would the interface stay link-down permanently?

The binding from this series only drops the phy-handle requirement when
fixed-link is present:

  - if:
      not:
        required:
          - fixed-link
    then:
      required:
        - phy-handle

So the binding still treats such a node as a phy-handle configuration.

No in-tree hix5hd2 DTS uses managed, and of_phy_get_and_connect() uses the
same precedence. The commit message doesn't mention this behaviour change,
though.

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261122230134.3366017-1-mmyangfl%40gmail.com
Technical Details
Message-ID: <179547497461.3135.10844552053295953627@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-369826-linux-kernel-netdev=dewy.ru
References: <20261122230134.3366017-3-mmyangfl@gmail.com>

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-369826-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v2 2/2] net: hix5hd2_gmac: support fixed-link and
 mdio child
Date: Mon, 23 Nov 2026 23:02:54 +0000
Organization: Usenet Network
Message-ID: <179547497461.3135.10844552053295953627@kernel.org>
References: <20261122230134.3366017-3-mmyangfl@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="4003944"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:JEav5avNXaEjZYNmqCXJXQ7XF7M= sha256:ocx4iLngRKlbduSAOZnHLanljLcD2og5GYGt7lUhMFQ=
	sha1:HNkaAmE8YjgUWobWNSAYbUUrigQ= sha256:p9BNiP+VOSyXUNlIXyvG6YNeUCPETD3uA6ZLqVmWU7o=
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 8E2B7125DC6; Tue, 24 Nov 2026 02:03:13 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, 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] 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 qdVzFeEDMedD;
	Tue, 24 Nov 2026 02:03:09 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-369826-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 5BF63125DB9; Tue, 24 Nov 2026 02:03:01 +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 2A29D2DA14; Mon, 23 Nov 2026 23:03:00 +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=1795474977;
	b=SXpV2sI+fjv8qq5AnyoKvKWwf9yPDdAEUp364s9mSmVzXQo65btVeOantrKdWqJyB68A
	 FAjRBBAQPsgJZIAt2TTXz+k9vPOUZcZPoNch0Ui6x74M+9rW55r23NpRqqFUBq1y4LKVS
	 RmDaCau+lDDMNuUBIjAiIq7cGMWwMkL+8jSfoXXAUNtE0uDsrqsj6fH1jVThvoq+u/ViJ
	 48UcCgyFHQtR65Nik5k03vAdFEPhL7qSx1bQ4prD8h6Cu+YCqSuKKa7jDfITaGc3IXhaW
	 sRfiTh7YWkEy+O4qLnspPzdLs8LU3p1+pCetkygZPmwEFiCSOqn3R6yQTeabG8M3sIg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795474977;
	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=FInmTlBBCijcidrB7kILO5RuU05i+OIdvD0BtPtPq/s=;
	b=MuIEZ8/K7MzuZOqJ4pV300RcDt8R7uDUMfmXlU6rwVOo1eH/Q8hQKm8R6dmVENh4Qn/j
	 adFvTWdkPRL/ipC7GnlEa+dofIC349Jfz1BE1oXU5uukcnNuSirFPpkjDKCkmNQfttNtq
	 vswFzXklXYdGhsWTW6I2bjbq2KH9LSopbwm/5kpOwTynOICOS9F98fLRxc7T3KAnbTGgV
	 Iin3668Bze6rKQjitXojMGIahTP4yks0gWXQ/6uWWjbQ9HN/dQZzNU451V5mITcS70TkA
	 lhYuHcxeYCMMBBYNnm8qyU3IMs52DEmzS2pzOrBvGGm5wPEsyr4oQe3gUknpkcNScuA==
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=NU91a9hh;
	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 97813606A330;
	Mon, 23 Nov 2026 23:02:57 +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=NU91a9hh
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=1795474976;
	b=cbFZ6TpW7rJBcR0Ui4C4EIad5sXCBM1Sh975UG6IPcx6wp8bPGW5YZ9XsY3C7D3Lzlwi
	 fTo9t60XIsNFlbGnTVTf9khCbWYolCPxjGyK8XP9cmWL9TwLTc4dpJGkSQmf4C0CRHt8h
	 ocEe0OAZcJkZfqJb5+NMCaawBrpYvtsLzkuuUSaw9yeQeW6PVbu+6qyQEY1cmXEK5/8hm
	 Oc+JLHuFY1W5PnCPkshLriShSHofpsOP/8QggNwFu2pSR/6DLZbCw7cFzasW+wQzL+w7F
	 ION8lr6NR8k4KL7H3fdN0oUo3Bz2t8ZVmZZI0CDxw3klBA8tY1bUiCKnsdr7gQzS8hA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795474976;
	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=FInmTlBBCijcidrB7kILO5RuU05i+OIdvD0BtPtPq/s=;
	b=ODJBSjexS80re/TY7i1385vWus43tNlM/H+4BVJQ3nZypUmNZmqPMyVtJq1Ywbl9vNmz
	 1oj6N4tpovAo5rVpJJMydeZSFifh+Y+qfeBAs9tpLvxm8CgFLjWhSPRaqPIv43FlWDyxd
	 bnXRCUqT5ixewgsbgAFTRhG8t3+cdwlBnlexM0Q7mC+2AEgM77VUBvIC51jmd696lKLxJ
	 9yt+VkUObGADMyzl7B+TYGtlJUtVhFPvsvD+qckAV/grwHX2XNkPtpSzidPrBigmvFQTL
	 RNXRyXIrY4v2IIkq4MWpwhkB/brcZOGIsobfGKQky5b/R7DmPfgBMKqgZ2/hFPoufqA==
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=NU91a9hh;
	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 AC7D2606A31E;
	Mon, 23 Nov 2026 23:02:56 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D3FC1F000CA;
	Mon, 23 Nov 2026 23:02:55 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795474975;
	bh=FInmTlBBCijcidrB7kILO5RuU05i+OIdvD0BtPtPq/s=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=NU91a9hhn63oTiYUAPjPGFF9+yK2JqPYxw/ALPef7cC3xiAgjdPmHgNS6PzTZ3IOe
	 oNA4OC8viaH7nEp4QPIqjj7fPhpxEte29OuZuC1hLGHAlTBIPWUL6yb9xkFiwkiHOF
	 s8uKnU+KA4iEm59YAvaYBkIFWg4hmwRYG1PJmkzzo8sf2HY6wOnVCXv22TarcRmw8T
	 FVnTGf6IELtxwsR4q84k0oxjNld+yvgJeU3AOFDZFCu7UWS/M6iIHu1/PH3+Kk3LNz
	 +ksoqqtMDtQBnDkQO082uV55EBmrjK1oFnYS+kVeRtHkJM5MIxlQ3MdqFNeDND57cf
	 Hes9rTwca5vzw==
X-Cc: netdev@vger.kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net,
 edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org,
 krzk+dt@kernel.org, conor+dt@kernel.org, shenjian15@huawei.com,
 shaojijie@huawei.com, devicetree@vger.kernel.org
X-In-Reply-To: <20261122230134.3366017-3-mmyangfl@gmail.com>
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