mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Andreas Schmidt <mail@schmidt-andreas.de>
To: barebox@lists.infradead.org
Subject: [PATCH v2] net: cpsw: fix probe with fixed-link
Date: Thu, 22 Feb 2018 23:16:27 +0100	[thread overview]
Message-ID: <20180222221627.12750-1-mail@schmidt-andreas.de> (raw)
In-Reply-To: <20180216074216.i47f5pswnhiayowe@pengutronix.de>

While cpsw is probe dt, it accepts only slaves nodes with "phy_id" property.
In case of fixed-link there are no "phy_id" property and probe would be failed.
This patch avoid the failure due to missing "phy_id" in case of fixed-link.

Signed-off-by: Andreas Schmidt <mail@schmidt-andreas.de>
---

Changes since v1:
  - rework after "[PATCH] net: cpsw: remove unnecessary mdiobus_scan()" patch was committed.

---
 drivers/net/cpsw.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
index 928b97774..3d3939cfa 100644
--- a/drivers/net/cpsw.c
+++ b/drivers/net/cpsw.c
@@ -1089,11 +1089,13 @@ static int cpsw_probe_dt(struct cpsw_priv *priv)
 
 		if (i < priv->num_slaves && !strncmp(child->name, "slave", 5)) {
 			struct cpsw_slave *slave = &priv->slaves[i];
-			uint32_t phy_id[2];
+			uint32_t phy_id[2] = {-1, -1};
 
-			ret = of_property_read_u32_array(child, "phy_id", phy_id, 2);
-			if (ret)
-				return ret;
+			if (!of_find_node_by_name(child, "fixed-link")) {
+				ret = of_property_read_u32_array(child, "phy_id", phy_id, 2);
+				if (ret)
+					return ret;
+			}
 
 			slave->dev.device_node = child;
 			slave->phy_id = phy_id[1];
-- 
2.14.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2018-02-22 22:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-13 21:48 [PATCH] " Andreas Schmidt
2018-02-16  7:42 ` Sascha Hauer
2018-02-22 22:16   ` Andreas Schmidt [this message]
2018-02-27  8:41     ` [PATCH v2] " Sascha Hauer

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=20180222221627.12750-1-mail@schmidt-andreas.de \
    --to=mail@schmidt-andreas.de \
    --cc=barebox@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox