mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Teresa Remmet <t.remmet@phytec.de>
To: barebox@lists.infradead.org
Subject: [PATCH v2 6/7] net: ethernet: cpsw: cpsw-phy-sel: Use phandle for phy sel
Date: Wed, 13 Feb 2019 09:34:27 +0100	[thread overview]
Message-ID: <1550046868-19264-6-git-send-email-t.remmet@phytec.de> (raw)
In-Reply-To: <1550046868-19264-1-git-send-email-t.remmet@phytec.de>

With the usage of the interconnect target module hierarchy in device tree the
cpsw-phy-sel node moved to the system control module. An phandle has
been added instead to the device tree include.

Try to use the cpsw-phy-sel phandle first then fall back looking for the
cpsw-phy-sel child.

This patch is based on the upstream kernel patch:
18eb8aea7fb2 ("net: ethernet: cpsw-phy-sel: prefer phandle for phy sel")

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
---
 drivers/net/cpsw.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
index 432004ec9ca8..65f71c6fce5a 100644
--- a/drivers/net/cpsw.c
+++ b/drivers/net/cpsw.c
@@ -1053,6 +1053,7 @@ static int cpsw_probe_dt(struct cpsw_priv *priv)
 {
 	struct device_d *dev = priv->dev;
 	struct device_node *np = dev->device_node, *child;
+	struct device_node *physel;
 	int ret, i = 0;
 
 	ret = of_property_read_u32(np, "slaves", &priv->num_slaves);
@@ -1061,13 +1062,17 @@ static int cpsw_probe_dt(struct cpsw_priv *priv)
 
 	priv->slaves = xzalloc(sizeof(struct cpsw_slave) * priv->num_slaves);
 
-	for_each_child_of_node(np, child) {
-		if (of_device_is_compatible(child, "ti,am3352-cpsw-phy-sel")) {
-			ret = cpsw_phy_sel_init(priv, child);
-			if (ret)
-				return ret;
-		}
+	physel = of_parse_phandle(dev->device_node, "cpsw-phy-sel", 0);
+	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");
+	}
+	ret = cpsw_phy_sel_init(priv, physel);
+	if (ret)
+		return ret;
 
+	for_each_child_of_node(np, child) {
 		if (of_device_is_compatible(child, "ti,davinci_mdio")) {
 			ret = of_pinctrl_select_state_default(child);
 			if (ret)
-- 
2.7.4


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

  parent reply	other threads:[~2019-02-13  8:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-13  8:34 [PATCH v2 1/7] drivers: bus: Add ti-sysc bus driver Teresa Remmet
2019-02-13  8:34 ` [PATCH v2 2/7] arm: configs: omap_defconfig: Enable " Teresa Remmet
2019-02-13  8:34 ` [PATCH v2 3/7] arm: configs: am33xx_mlo_defconfig: " Teresa Remmet
2019-02-13  8:34 ` [PATCH v2 4/7] drivers: of: Add function to enable and register a device by alias Teresa Remmet
2019-02-13  8:34 ` [PATCH v2 5/7] arm: mach-omap: am335x_generic: Enable nodes by alias where needed Teresa Remmet
2019-02-13  8:34 ` Teresa Remmet [this message]
2019-02-13  8:34 ` [PATCH v2 7/7] arm: dts: am335x-phytec: Use phy-handle instead of phy_id Teresa Remmet
2019-02-13 19:30 ` [PATCH v2 1/7] drivers: bus: Add ti-sysc bus driver 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=1550046868-19264-6-git-send-email-t.remmet@phytec.de \
    --to=t.remmet@phytec.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