netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: "xiaowu.ding" <xiaowu.ding@jaguarmicro.com>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, linux@armlinux.org.uk,
	nicolas.ferre@microchip.com, claudiu.beznea@microchip.com,
	palmer@dabbelt.com, paul.walmsley@sifive.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-riscv@lists.infradead.org
Subject: Re: [PATCH net-next] driver: cadence macb driver support acpi mode
Date: Wed, 24 Aug 2022 17:25:55 +0200	[thread overview]
Message-ID: <YwZDA0CuYwPE6DM2@lunn.ch> (raw)
In-Reply-To: <20220824121351.578-1-xiaowu.ding@jaguarmicro.com>

> +static int macb_acpi_phylink_connect(struct macb *bp)
> +{
> +	struct fwnode_handle *fwnd = bp->pdev->dev.fwnode;
> +	struct net_device *dev = bp->dev;
> +	struct phy_device *phydev;
> +	int ret;
> +
> +	if (fwnd)
> +		ret = phylink_fwnode_phy_connect(bp->phylink, fwnd, 0);
> +
> +	if (!fwnd || (ret && !macb_acpi_phy_handle_exists(fwnd))) {
> +		phydev = phy_find_first(bp->mii_bus);

Please don't use phy_find_first. That is somewhat historical. Since
this is a new binding, simply error out if
phylink_fwnode_phy_connect() fails.

> +static int macb_acpi_mdiobus_register(struct macb *bp)
> +{
> +	struct platform_device *pdev =	bp->pdev;
> +	struct fwnode_handle *fwnode = pdev->dev.fwnode;
> +	struct fwnode_handle *child;
> +	u32 addr;
> +	int ret;
> +
> +	if (!IS_ERR_OR_NULL(fwnode_find_reference(pdev->dev.fwnode, "fixed-link", 0)))
> +		return mdiobus_register(bp->mii_bus);
> +
> +	fwnode_for_each_child_node(fwnode, child) {
> +		ret = acpi_get_local_address(ACPI_HANDLE_FWNODE(child), &addr);
> +		if (ret || addr >= PHY_MAX_ADDR)
> +			continue;
> +		ret = acpi_mdiobus_register(bp->mii_bus, fwnode);
> +		if (!ret)
> +			return ret;
> +		break;

Why loop looking for a node with a register value < 32?

Please make sure you are conformant with Documentation/firmware-guide/acpi/dsd/phy.rst

       Andrew

      parent reply	other threads:[~2022-08-24 15:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-24 12:13 [PATCH net-next] driver: cadence macb driver support acpi mode xiaowu.ding
2022-08-24 13:10 ` Russell King (Oracle)
2022-08-24 15:17 ` Andrew Lunn
2022-09-05  2:25   ` 答复: " Xiaowu Ding
2022-09-05 17:13     ` Andrew Lunn
2022-11-14 11:41       ` [PATCH v2] net:macb: " xiaowu.ding
2022-11-16 17:15         ` Jakub Kicinski
2022-08-24 15:25 ` Andrew Lunn [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=YwZDA0CuYwPE6DM2@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=claudiu.beznea@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=pabeni@redhat.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=xiaowu.ding@jaguarmicro.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;
as well as URLs for NNTP newsgroup(s).