Skip to contentSkip to conversation

net: phy: micrel: Get phy node from phy-handle

PATCH In review Jit Loon Lim 2 participants 3 messages Nov 22, 2022 – Nov 28, 2022

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

PATCH 1/1 net: phy: micrel: Get phy node from phy-handle

From: Ley Foon Tan <[email protected]>

HSD #1509063521: Try to get phy node from "phy-handle" if can't find ethernet-phy subnode. Lastly only use Ethernet node if can't find phy node from ethernet-phy subnode and phy-handle.

---
 drivers/net/phy/micrel_ksz90x1.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/net/phy/micrel_ksz90x1.c +9 -2
index e5f578201f..e33789b7f7 100644
@@ -112,6 +112,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;
@@ -128,8 +129,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++) {
Signature · 1 line
2.26.2
#1 lore raw
Quoted 4 lines · Jit Loon Lim

From: Ley Foon Tan <[email protected]>

HSD #1509063521: Try to get phy node from "phy-handle" if can't find ethernet-phy subnode.

What is this HSD ? Intel internal ?
Please remove.

Quoted 41 lines

Lastly only use Ethernet node if can't find phy node from ethernet-phy subnode and phy-handle.

---
 drivers/net/phy/micrel_ksz90x1.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/net/phy/micrel_ksz90x1.c +9 -3
index e5f578201f..e33789b7f7 100644
@@ -112,6 +112,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;
@@ -128,8 +129,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++) {
--

2.26.2

#2 lore raw

-----Original Message-----
From: Ramon Fried <[email protected]>
Sent: Sunday, 27 November, 2022 6:50 AM
To: Lim, Jit Loon <[email protected]>
Cc: [email protected]; Jagan Teki <[email protected]>; Vignesh R <[email protected]>; Vasut, Marek <[email protected]>; Simon <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Lim, Elly Siew Chin <[email protected]>; Kho, Sin Hui <[email protected]>; Lokanathan, Raaj <[email protected]>; Maniyam, Dinesh <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Chong, Teik Heng <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Tang, Sieu Mun <[email protected]>; Ley Foon Tan <[email protected]>
Subject: Re: [PATCH] net: phy: micrel: Get phy node from phy-handle

Quoted 4 lines · Jit Loon Lim

From: Ley Foon Tan <[email protected]>

HSD #1509063521: Try to get phy node from "phy-handle" if can't find ethernet-phy subnode.

What is this HSD ? Intel internal ?
Please remove.

Yes, this is for Intel internal tracking. We shall remove it and update the patch.

Quoted 42 lines

Lastly only use Ethernet node if can't find phy node from ethernet-phy subnode and phy-handle.

---
 drivers/net/phy/micrel_ksz90x1.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/net/phy/micrel_ksz90x1.c +9 -3
index e5f578201f..e33789b7f7 100644
@@ -112,6 +112,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;
@@ -128,8 +129,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++) {
--

2.26.2