mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] net: cpsw: adopt to upstream device tree changes
Date: Wed, 10 Jul 2019 09:30:28 +0200	[thread overview]
Message-ID: <20190710073028.1387-1-s.hauer@pengutronix.de> (raw)

Upstream device trees no longer have a "cpsw-phy-sel" property to find
the phy_sel register, instead they have a child device of the pinctrl
node compatible to "ti,am3352-phy-gmii-sel". Also the "rmii-clock-ext"
property is no longer global to the cpsw but instead can be selected
per slave. To adopt to these changes take the short way out for now
and find the new node by its compatible and hardcode the "rmii-clock-ext"
setting (which is set to true in am33xx-l4.dtsi and not overwritten
by any board).

This makes the cpsw driver work again. Tested on Beaglebone black
board.

Fixes: 1dc748b3b2 ("dts: update to v5.1-rc1")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/net/cpsw.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
index 65f71c6fce..df8981d02e 100644
--- a/drivers/net/cpsw.c
+++ b/drivers/net/cpsw.c
@@ -993,8 +993,13 @@ static int cpsw_phy_sel_init(struct cpsw_priv *priv, struct device_node *np)
 
 	phy_sel_addr = (void *)addr;
 
-	if (of_property_read_bool(np, "rmii-clock-ext"))
-		rmii_clock_external = true;
+	/*
+	 * As of Linux-5.1 this is set to true in am33xx-l4.dtsi and not
+	 * overwritten by any board. This is set to false in am437x-l4.dtsi
+	 * though, so once we support this SoC we have to configure this from
+	 * the device tree.
+	 */
+	rmii_clock_external = true;
 
 	return 0;
 }
@@ -1062,11 +1067,10 @@ static int cpsw_probe_dt(struct cpsw_priv *priv)
 
 	priv->slaves = xzalloc(sizeof(struct cpsw_slave) * priv->num_slaves);
 
-	physel = of_parse_phandle(dev->device_node, "cpsw-phy-sel", 0);
+	physel = of_find_compatible_node(NULL, NULL, "ti,am3352-phy-gmii-sel");
 	if (!physel) {
-		physel = of_get_child_by_name(dev->device_node, "cpsw-phy-sel");
-		if (!physel)
-			dev_err(dev, "Phy mode node not found\n");
+		dev_err(dev, "Cannot find ti,am3352-phy-gmii-sel node\n");
+		return -EINVAL;
 	}
 	ret = cpsw_phy_sel_init(priv, physel);
 	if (ret)
-- 
2.20.1


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

                 reply	other threads:[~2019-07-10  7:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20190710073028.1387-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.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