public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn•ch>
To: Linus Walleij <linus.walleij@linaro•org>
Cc: netdev@vger•kernel.org, "David S . Miller" <davem@davemloft•net>,
	Jakub Kicinski <kuba@kernel•org>, Zoltan HERPAI <wigyori@uid0•hu>,
	Raylynn Knight <rayknight@me•com>
Subject: Re: [PATCH 2/3] net: ethernet: ixp4xx: Support device tree probing
Date: Tue, 20 Apr 2021 03:35:48 +0200	[thread overview]
Message-ID: <YH4v9AWjVMtGqLAw@lunn.ch> (raw)
In-Reply-To: <20210419225133.2005360-2-linus.walleij@linaro.org>

> +	phy_np = of_parse_phandle(np, "phy-handle", 0);
> +	if (phy_np) {
> +		ret = of_property_read_u32(phy_np, "reg", &val);
> +		if (ret) {
> +			dev_err(dev, "cannot find phy reg\n");
> +			return NULL;
> +		}
> +		of_node_put(phy_np);
> +	} else {
> +		dev_err(dev, "cannot find phy instance\n");
> +		val = 0;
> +	}
> +	plat->phy = val;

phy-handle can point to a PHY on any bus. You should not assume it is
the devices own bus. Once you have phy_np call of_phy_find_device()
which gives you the actual phy device. Please don't let the
limitations of the current platform data limit you from implementing
this correctly.

      Andrew


  reply	other threads:[~2021-04-20  1:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-19 22:51 [PATCH 1/3] net: ethernet: ixp4xx: Add DT bindings Linus Walleij
2021-04-19 22:51 ` [PATCH 2/3] net: ethernet: ixp4xx: Support device tree probing Linus Walleij
2021-04-20  1:35   ` Andrew Lunn [this message]
2021-04-20  8:38     ` Linus Walleij
2021-04-19 22:51 ` [PATCH 3/3] net: ethernet: ixp4xx: Use OF MDIO bus registration Linus Walleij
2021-04-19 22:54   ` Linus Walleij
2021-04-20  1:47   ` Andrew Lunn
2021-04-20  8:44     ` Linus Walleij
2021-04-20 12:53       ` Andrew Lunn
2021-04-20  1:26 ` [PATCH 1/3] net: ethernet: ixp4xx: Add DT bindings Andrew Lunn
2021-04-22 15:39   ` Linus Walleij
2021-04-22 15:56     ` Andrew Lunn
2021-04-22 17:33       ` Linus Walleij
2021-04-22 20:13         ` Andrew Lunn

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=YH4v9AWjVMtGqLAw@lunn.ch \
    --to=andrew@lunn$(echo .)ch \
    --cc=davem@davemloft$(echo .)net \
    --cc=kuba@kernel$(echo .)org \
    --cc=linus.walleij@linaro$(echo .)org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=rayknight@me$(echo .)com \
    --cc=wigyori@uid0$(echo .)hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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