All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jit Loon Lim <jit.loon.lim@intel.com>
To: u-boot@lists.denx.de
Cc: Jagan Teki <jagan@amarulasolutions.com>,
	Vignesh R <vigneshr@ti.com>, Marek <marex@denx.de>,
	Simon <simon.k.r.goldschmidt@gmail.com>,
	Tien Fong <tien.fong.chee@intel.com>,
	Kok Kiang <kok.kiang.hea@intel.com>,
	Siew Chin <elly.siew.chin.lim@intel.com>,
	Sin Hui <sin.hui.kho@intel.com>, Raaj <raaj.lokanathan@intel.com>,
	Dinesh <dinesh.maniyam@intel.com>,
	Boon Khai <boon.khai.ng@intel.com>,
	Alif <alif.zakuan.yuslaimi@intel.com>,
	Teik Heng <teik.heng.chong@intel.com>,
	Hazim <muhammad.hazim.izzat.zamri@intel.com>,
	Jit Loon Lim <jit.loon.lim@intel.com>,
	Sieu Mun Tang <sieu.mun.tang@intel.com>,
	Ley Foon Tan <ley.foon.tan@intel.com>
Subject: [PATCH] net: phy: micrel: Get phy node from phy-handle
Date: Tue, 22 Nov 2022 22:41:01 +0800	[thread overview]
Message-ID: <20221122144101.21048-1-jit.loon.lim@intel.com> (raw)

From: Ley Foon Tan <ley.foon.tan@intel.com>

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.

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
Signed-off-by: Jit Loon Lim <jit.loon.lim@intel.com>
---
 drivers/net/phy/micrel_ksz90x1.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/micrel_ksz90x1.c b/drivers/net/phy/micrel_ksz90x1.c
index e5f578201f..e33789b7f7 100644
--- a/drivers/net/phy/micrel_ksz90x1.c
+++ b/drivers/net/phy/micrel_ksz90x1.c
@@ -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


             reply	other threads:[~2022-11-22 14:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-22 14:41 Jit Loon Lim [this message]
2022-11-26 22:50 ` [PATCH] net: phy: micrel: Get phy node from phy-handle Ramon Fried
2022-11-28  1:45   ` Lim, Jit Loon
  -- strict thread matches above, loose matches on Subject: below --
2021-04-26  3:43 Ley Foon Tan
2021-04-29 20:26 ` Ramon Fried

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221122144101.21048-1-jit.loon.lim@intel.com \
    --to=jit.loon.lim@intel.com \
    --cc=alif.zakuan.yuslaimi@intel.com \
    --cc=boon.khai.ng@intel.com \
    --cc=dinesh.maniyam@intel.com \
    --cc=elly.siew.chin.lim@intel.com \
    --cc=jagan@amarulasolutions.com \
    --cc=kok.kiang.hea@intel.com \
    --cc=ley.foon.tan@intel.com \
    --cc=marex@denx.de \
    --cc=muhammad.hazim.izzat.zamri@intel.com \
    --cc=raaj.lokanathan@intel.com \
    --cc=sieu.mun.tang@intel.com \
    --cc=simon.k.r.goldschmidt@gmail.com \
    --cc=sin.hui.kho@intel.com \
    --cc=teik.heng.chong@intel.com \
    --cc=tien.fong.chee@intel.com \
    --cc=u-boot@lists.denx.de \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.