diff options
Diffstat (limited to 'drivers/net/ucc_geth.c')
-rw-r--r-- | drivers/net/ucc_geth.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index 11441225bf41..e87986867ba5 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
@@ -1536,6 +1536,11 @@ static void adjust_link(struct net_device *dev) | |||
1536 | static int init_phy(struct net_device *dev) | 1536 | static int init_phy(struct net_device *dev) |
1537 | { | 1537 | { |
1538 | struct ucc_geth_private *priv = netdev_priv(dev); | 1538 | struct ucc_geth_private *priv = netdev_priv(dev); |
1539 | struct device_node *np = priv->node; | ||
1540 | struct device_node *phy, *mdio; | ||
1541 | const phandle *ph; | ||
1542 | char bus_name[MII_BUS_ID_SIZE]; | ||
1543 | const unsigned int *id; | ||
1539 | struct phy_device *phydev; | 1544 | struct phy_device *phydev; |
1540 | char phy_id[BUS_ID_SIZE]; | 1545 | char phy_id[BUS_ID_SIZE]; |
1541 | 1546 | ||
@@ -1543,8 +1548,18 @@ static int init_phy(struct net_device *dev) | |||
1543 | priv->oldspeed = 0; | 1548 | priv->oldspeed = 0; |
1544 | priv->oldduplex = -1; | 1549 | priv->oldduplex = -1; |
1545 | 1550 | ||
1546 | snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, priv->ug_info->mdio_bus, | 1551 | ph = of_get_property(np, "phy-handle", NULL); |
1547 | priv->ug_info->phy_address); | 1552 | phy = of_find_node_by_phandle(*ph); |
1553 | mdio = of_get_parent(phy); | ||
1554 | |||
1555 | id = of_get_property(phy, "reg", NULL); | ||
1556 | |||
1557 | of_node_put(phy); | ||
1558 | of_node_put(mdio); | ||
1559 | |||
1560 | uec_mdio_bus_name(bus_name, mdio); | ||
1561 | snprintf(phy_id, sizeof(phy_id), "%s:%02x", | ||
1562 | bus_name, *id); | ||
1548 | 1563 | ||
1549 | phydev = phy_connect(dev, phy_id, &adjust_link, 0, priv->phy_interface); | 1564 | phydev = phy_connect(dev, phy_id, &adjust_link, 0, priv->phy_interface); |
1550 | 1565 | ||
@@ -3748,6 +3763,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma | |||
3748 | 3763 | ||
3749 | ugeth->ug_info = ug_info; | 3764 | ugeth->ug_info = ug_info; |
3750 | ugeth->dev = dev; | 3765 | ugeth->dev = dev; |
3766 | ugeth->node = np; | ||
3751 | 3767 | ||
3752 | return 0; | 3768 | return 0; |
3753 | } | 3769 | } |