[PATCH 2/2] net: cpsw: Set phy device_node pointer in probe
Wadim Egorov
w.egorov at phytec.de
Tue Oct 28 03:50:36 PDT 2014
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 at 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
More information about the barebox
mailing list