diff options
author | Naresh Kumar Ravulapalli <nareshkumar.ravulapalli@altera.com> | 2025-06-30 21:49:23 -0700 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2025-07-10 08:40:45 -0600 |
commit | acf964c4758e2a60656a385f27dea0250fbbe7e6 (patch) | |
tree | 59686f14f6f7c8885e95fd5b44b609ca6a7704ae | |
parent | 344e1798059ba65769272be3145736685bb25a7e (diff) |
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>
-rw-r--r-- | drivers/net/phy/micrel_ksz90x1.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/net/phy/micrel_ksz90x1.c b/drivers/net/phy/micrel_ksz90x1.c index ee8eae1efd9..a02dbe900b8 100644 --- a/drivers/net/phy/micrel_ksz90x1.c +++ b/drivers/net/phy/micrel_ksz90x1.c @@ -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++) { |