aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ucc_geth.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ucc_geth.c')
-rw-r--r--drivers/net/ucc_geth.c34
1 files changed, 10 insertions, 24 deletions
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index e87986867ba5..1f61e42c641d 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -1536,32 +1536,15 @@ static void adjust_link(struct net_device *dev)
1536static int init_phy(struct net_device *dev) 1536static 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; 1539 struct ucc_geth_info *ug_info = priv->ug_info;
1540 struct device_node *phy, *mdio;
1541 const phandle *ph;
1542 char bus_name[MII_BUS_ID_SIZE];
1543 const unsigned int *id;
1544 struct phy_device *phydev; 1540 struct phy_device *phydev;
1545 char phy_id[BUS_ID_SIZE];
1546 1541
1547 priv->oldlink = 0; 1542 priv->oldlink = 0;
1548 priv->oldspeed = 0; 1543 priv->oldspeed = 0;
1549 priv->oldduplex = -1; 1544 priv->oldduplex = -1;
1550 1545
1551 ph = of_get_property(np, "phy-handle", NULL); 1546 phydev = phy_connect(dev, ug_info->phy_bus_id, &adjust_link, 0,
1552 phy = of_find_node_by_phandle(*ph); 1547 priv->phy_interface);
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);
1563
1564 phydev = phy_connect(dev, phy_id, &adjust_link, 0, priv->phy_interface);
1565 1548
1566 if (IS_ERR(phydev)) { 1549 if (IS_ERR(phydev)) {
1567 printk("%s: Could not attach to PHY\n", dev->name); 1550 printk("%s: Could not attach to PHY\n", dev->name);
@@ -3629,10 +3612,12 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3629 ug_info->uf_info.irq = irq_of_parse_and_map(np, 0); 3612 ug_info->uf_info.irq = irq_of_parse_and_map(np, 0);
3630 fixed_link = of_get_property(np, "fixed-link", NULL); 3613 fixed_link = of_get_property(np, "fixed-link", NULL);
3631 if (fixed_link) { 3614 if (fixed_link) {
3632 snprintf(ug_info->mdio_bus, MII_BUS_ID_SIZE, "0"); 3615 snprintf(ug_info->phy_bus_id, sizeof(ug_info->phy_bus_id),
3633 ug_info->phy_address = fixed_link[0]; 3616 PHY_ID_FMT, "0", fixed_link[0]);
3634 phy = NULL; 3617 phy = NULL;
3635 } else { 3618 } else {
3619 char bus_name[MII_BUS_ID_SIZE];
3620
3636 ph = of_get_property(np, "phy-handle", NULL); 3621 ph = of_get_property(np, "phy-handle", NULL);
3637 phy = of_find_node_by_phandle(*ph); 3622 phy = of_find_node_by_phandle(*ph);
3638 3623
@@ -3643,7 +3628,6 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3643 prop = of_get_property(phy, "reg", NULL); 3628 prop = of_get_property(phy, "reg", NULL);
3644 if (prop == NULL) 3629 if (prop == NULL)
3645 return -1; 3630 return -1;
3646 ug_info->phy_address = *prop;
3647 3631
3648 /* Set the bus id */ 3632 /* Set the bus id */
3649 mdio = of_get_parent(phy); 3633 mdio = of_get_parent(phy);
@@ -3657,7 +3641,9 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3657 if (err) 3641 if (err)
3658 return -1; 3642 return -1;
3659 3643
3660 snprintf(ug_info->mdio_bus, MII_BUS_ID_SIZE, "%x", res.start); 3644 uec_mdio_bus_name(bus_name, mdio);
3645 snprintf(ug_info->phy_bus_id, sizeof(ug_info->phy_bus_id),
3646 "%s:%02x", bus_name, *prop);
3661 } 3647 }
3662 3648
3663 /* get the phy interface type, or default to MII */ 3649 /* get the phy interface type, or default to MII */