mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Wadim Egorov <w.egorov@phytec.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/2] net: cpsw: Set phy device_node pointer in probe
Date: Tue, 28 Oct 2014 11:50:36 +0100	[thread overview]
Message-ID: <1414493436-23693-2-git-send-email-w.egorov@phytec.de> (raw)
In-Reply-To: <1414493436-23693-1-git-send-email-w.egorov@phytec.de>

Set the phy device_node pointer to the equivalent cpsw slave node.
We need this, because phy drivers using this pointer for their configuration.

Create and register the phy device in cpsw_probe(), so that this phy device
can be found later by phy_device_connect() in cpsw_open().

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
---
 drivers/net/cpsw.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
index 167b2dd..a0621f5 100644
--- a/drivers/net/cpsw.c
+++ b/drivers/net/cpsw.c
@@ -1200,6 +1200,19 @@ int cpsw_probe(struct device_d *dev)
 	mdiobus_register(&priv->miibus);
 
 	for (i = 0; i < priv->num_slaves; i++) {
+		struct phy_device *phy;
+
+		phy = mdiobus_scan(&priv->miibus, priv->slaves[i].phy_id);
+		if (IS_ERR(phy)) {
+			ret = PTR_ERR(phy);
+			goto out;
+		}
+
+		phy->dev.device_node = priv->slaves[i].dev.device_node;
+		ret = phy_register_device(phy);
+		if (ret)
+			goto out;
+
 		ret = cpsw_slave_setup(&priv->slaves[i], i, priv);
 		if (ret)
 			goto out;
-- 
1.7.0.4


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

  reply	other threads:[~2014-10-28 10:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-28 10:50 [PATCH 1/2] net: phy: micrel: Add OF conf. support for ksz9031 Wadim Egorov
2014-10-28 10:50 ` Wadim Egorov [this message]
2014-11-03  7:18 ` 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=1414493436-23693-2-git-send-email-w.egorov@phytec.de \
    --to=w.egorov@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