Skip to contentSkip to conversation

net: phy: micrel: Try default PHY ofnode first

PATCH New Marek Vasut 2 participants 2 messages Jan 16, 2021 – Jan 27, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: phy: micrel: Try default PHY ofnode first

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.

Cc Joe Hershberger <[email protected]>
Cc Ramon Fried <[email protected]>
---
 drivers/net/phy/micrel_ksz90x1.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/phy/micrel_ksz90x1.c +7 -2
index f0032e8ce16..23a018c2c25 100644
@@ -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);
Signature · 1 line
2.29.2
#1 lore raw

PATCH 1/1 net: phy: micrel: Try default PHY ofnode first

Quoted 8 lines · Marek Vasut

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.

Cc Joe Hershberger <[email protected]>
Cc Ramon Fried <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
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>