drivers: net: phy: micrel: Try to get phy node from phy-handle

If phy node isn't found in ethernet-phy subnode, try to get it from
phy-handle. And when this fails, only then use Ethernet node. This
fix results in getting correct phy handle properties for the
phy node if defined.

Signed-off-by: Naresh Kumar Ravulapalli <nareshkumar.ravulapalli@altera.com>
This commit is contained in:
Naresh Kumar Ravulapalli
2025-07-10 08:40:45 -06:00
committed by Tom Rini
parent 344e179805
commit acf964c475
+10 -2
View File
@@ -7,6 +7,7 @@
* (C) 2012 NetModule AG, David Andrey, added KSZ9031
* (C) Copyright 2017 Adaptrum, Inc.
* Written by Alexandru Gagniuc <alex.g@adaptrum.com> for Adaptrum, Inc.
* Copyright (C) 2025 Altera Corporation <www.altera.com>
*/
#include <dm.h>
#include <env.h>
@@ -110,6 +111,7 @@ static int ksz90x1_of_config_group(struct phy_device *phydev,
{
struct udevice *dev = phydev->dev;
struct phy_driver *drv = phydev->drv;
struct ofnode_phandle_args phandle;
int val[4];
int i, changed = 0, offset, max;
u16 regval = 0;
@@ -126,8 +128,14 @@ static int ksz90x1_of_config_group(struct phy_device *phydev,
}
if (!ofnode_valid(node)) {
/* No node found, look in the Ethernet node */
node = dev_ofnode(dev);
if (dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0,
&phandle)) {
/* No phy-handle found, look in the Ethernet node */
node = dev_ofnode(dev);
} else {
/* phy-handle found */
node = phandle.node;
}
}
for (i = 0; i < ofcfg->grpsz; i++) {