9
0
Fork 0

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>
This commit is contained in:
Wadim Egorov 2014-10-28 11:50:36 +01:00 committed by Sascha Hauer
parent d75ff89817
commit 30427fb2da
1 changed files with 13 additions and 0 deletions

View File

@ -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;