From: Marek Vasut Date: Sat, 16 Jan 2021 23:16:16 +0000 (+0100) Subject: net: phy: micrel: Try default PHY ofnode first X-Git-Url: http://git.dujemihanovic.xyz/img/sics.gif?a=commitdiff_plain;h=b5f09df246a8a24a3b4acb669cbf95d2a063176b;p=u-boot.git 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. Signed-off-by: Marek Vasut Cc: Joe Hershberger Cc: Ramon Fried --- diff --git a/drivers/net/phy/micrel_ksz90x1.c b/drivers/net/phy/micrel_ksz90x1.c index 77fad4a8fc..e5f578201f 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);