From: Naresh Kumar Ravulapalli Date: Tue, 1 Jul 2025 04:49:23 +0000 (-0700) Subject: drivers: net: phy: micrel: Try to get phy node from phy-handle X-Git-Tag: v2025.10-rc1~110 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=acf964c4758e2a60656a385f27dea0250fbbe7e6;p=thirdparty%2Fu-boot.git 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 --- 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 for Adaptrum, Inc. + * Copyright (C) 2025 Altera Corporation */ #include #include @@ -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++) {