diff options
author | Wadim Egorov <w.egorov@phytec.de> | 2014-10-28 11:50:36 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-11-03 08:18:10 +0100 |
commit | 30427fb2da179e98055b33f75d3b0f2ad29f79be (patch) | |
tree | 91d832a078831b45c3db39e7c1d04d539d019b5a /drivers/net/cpsw.c | |
parent | d75ff89817a72cb83f171febf314255da0a6cd12 (diff) | |
download | barebox-30427fb2da179e98055b33f75d3b0f2ad29f79be.tar.gz barebox-30427fb2da179e98055b33f75d3b0f2ad29f79be.tar.xz |
net: cpsw: Set phy device_node pointer in probe
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>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/net/cpsw.c')
-rw-r--r-- | 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 167b2ddf8b..a0621f5986 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; |