public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] net: phy: micrel: Try default PHY ofnode first
@ 2021-01-16 23:16 Marek Vasut
  2021-01-27 19:22 ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Marek Vasut @ 2021-01-16 23:16 UTC (permalink / raw)
  To: u-boot

The phydev structure has a PHY OF node pointer in it, use that OF node
first when looking up PHY OF node properties, since that is likely the
correct PHY OF node pointer. If the pointer is not valid, which is the
case e.g. on legacy DTs, fall back to parsing MAC ethernet-phy subnode.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
---
 drivers/net/phy/micrel_ksz90x1.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/micrel_ksz90x1.c b/drivers/net/phy/micrel_ksz90x1.c
index f0032e8ce16..23a018c2c25 100644
--- a/drivers/net/phy/micrel_ksz90x1.c
+++ b/drivers/net/phy/micrel_ksz90x1.c
@@ -120,8 +120,13 @@ static int ksz90x1_of_config_group(struct phy_device *phydev,
 	if (!drv || !drv->writeext)
 		return -EOPNOTSUPP;
 
-	/* Look for a PHY node under the Ethernet node */
-	node = dev_read_subnode(dev, "ethernet-phy");
+	node = phydev->node;
+
+	if (!ofnode_valid(node)) {
+		/* Look for a PHY node under the Ethernet node */
+		node = dev_read_subnode(dev, "ethernet-phy");
+	}
+
 	if (!ofnode_valid(node)) {
 		/* No node found, look in the Ethernet node */
 		node = dev_ofnode(dev);
-- 
2.29.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] net: phy: micrel: Try default PHY ofnode first
  2021-01-16 23:16 [PATCH] net: phy: micrel: Try default PHY ofnode first Marek Vasut
@ 2021-01-27 19:22 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2021-01-27 19:22 UTC (permalink / raw)
  To: u-boot

On Sun, Jan 17, 2021 at 12:16:16AM +0100, Marek Vasut wrote:

> The phydev structure has a PHY OF node pointer in it, use that OF node
> first when looking up PHY OF node properties, since that is likely the
> correct PHY OF node pointer. If the pointer is not valid, which is the
> case e.g. on legacy DTs, fall back to parsing MAC ethernet-phy subnode.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Joe Hershberger <joe.hershberger@ni.com>
> Cc: Ramon Fried <rfried.dev@gmail.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210127/6315928e/attachment.sig>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-27 19:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-16 23:16 [PATCH] net: phy: micrel: Try default PHY ofnode first Marek Vasut
2021-01-27 19:22 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox