Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: mmyangfl@gmail.com
Cc: netdev@vger.kernel.org, shenjian15@huawei.com,
	shaojijie@huawei.com, andrew+netdev@lunn.ch, davem@davemloft.net,
	edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com
Subject: Re: [PATCH net-next] net: hix5hd2_gmac: support fixed-link
Date: Tue, 24 Nov 2026 03:12:48 +0000	[thread overview]
Message-ID: <179548996825.3135.16418644691427963139@kernel.org> (raw)
In-Reply-To: <20261120031026.1371052-1-mmyangfl@gmail.com>

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:1192-1197), the fixed-…
- [Low] After this patch, hix5hd2_dev_probe() accepts a node that has
  'fixed-link' and no 'phy-handle'…

--

net: hix5hd2_gmac: support fixed-link

This commit adds fixed-link support to hix5hd2_gmac for Hi3716cv200, where
the MAC is wired directly to another MAC with no PHY. When fixed-link is
present, the MDIO bus is registered with mdiobus_register() and all
addresses masked, and the fixed-link PHY is registered in place of the
phy-handle lookup.

> diff --git a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
> index 12a5657653f85..dd4ba6d7a1574 100644
> --- a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
> +++ b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
> @@ -1189,7 +1189,12 @@ static int hix5hd2_dev_probe(struct platform_device *pdev)
>  	snprintf(bus->id, MII_BUS_ID_SIZE, "%s-mii", dev_name(&pdev->dev));
>  	priv->bus = bus;
>  
> -	ret = of_mdiobus_register(bus, node);
> +	if (of_phy_is_fixed_link(node)) {
> +		bus->phy_mask = ~0;
> +		ret = mdiobus_register(bus);
> +	} else {
> +		ret = of_mdiobus_register(bus, node);
> +	}

[Severity: Medium]
Does the commit message match what this hunk does? The message says:

    Suppress the warning by masking out all PHY address.

__of_mdiobus_register() in drivers/net/mdio/of_mdio.c already masks every
address before it registers the bus:

    /* Mask out all PHYs from auto probing.  Instead the PHYs listed in
     * the device tree are populated after the bus has been registered */
    mdio->phy_mask = ~0;

So setting bus->phy_mask = ~0 is not what stops the 32 lines of output.

The output seems to come from the fixed-link child node. It has no reg
property, so __of_mdiobus_parse_phys() sets scanphys. It also has no
compatible property, so of_mdiobus_child_is_phy() treats it as a PHY:

    if (!of_property_present(child, "compatible"))
        return true;

The auto-scan loop in __of_mdiobus_register() then prints this for every
address:

    dev_info(&mdio->dev, "scan phy %pOFn at address %i\n",
             child, addr);

What actually removes the output is skipping OF registration altogether.

That has a side effect when fixed-link is present. The bus gets no fwnode,
so DT children of the MAC node are never populated and of_mdio_find_bus()
cannot find this bus.

The hisilicon,hisi-gmac-v1.yaml binding includes mdio.yaml, which
describes the MAC node as an MDIO bus with optional children. Take a
switch whose CPU port is on a fixed link and which is managed over this
GMAC's MDIO lines. Can that setup still be described, or is the
registered mii_bus left with nothing able to use it?

Fixed-link nodes failed probe before this patch, so this is not a
regression of existing behaviour. Could the commit message at least state
this limitation and describe the mechanism accurately?

>  	if (ret)
>  		goto err_free_mdio;
>  
> @@ -1199,11 +1204,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);
> +		if (!priv->phy_node) {
> +			netdev_err(ndev, "not find phy-handle\n");
> +			ret = -EINVAL;
> +			goto err_mdiobus;
> +		}
>  	}

[Severity: Low]
Does the DT binding need updating along with this? hix5hd2_dev_probe() now
accepts a node with fixed-link and no phy-handle. However,
Documentation/devicetree/bindings/net/hisilicon,hisi-gmac-v1.yaml still
requires phy-handle unconditionally:

    required:
      - compatible
      - reg
      - interrupts
      - clocks
      - clock-names
      - phy-mode
      - phy-handle

The fixed-link property itself passes through the ethernet-controller.yaml
$ref. The required phy-handle rule does not, so a Hi3716cv200 DTS that
uses fixed-link alone would fail dtbs_check.

Would a oneOf or if/then that accepts fixed-link instead of phy-handle
fit here?

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261120031026.1371052-1-mmyangfl%40gmail.com

      parent reply	other threads:[~2026-11-24  3:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  3:10 [PATCH net-next] net: hix5hd2_gmac: support fixed-link David Yang
2026-11-20  3:58 ` Andrew Lunn
2026-11-24  3:12 ` 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=179548996825.3135.16418644691427963139@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=mmyangfl@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shaojijie@huawei.com \
    --cc=shenjian15@huawei.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