aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ucc_geth.c
diff options
context:
space:
mode:
authorHaiying Wang <Haiying.Wang@freescale.com>2009-01-29 20:28:04 -0500
committerDavid S. Miller <davem@davemloft.net>2009-01-29 20:28:04 -0500
commitb1c4a9dddf09fe99b8f88252718ac5b357363dc4 (patch)
treec898bb74a859e7eae7220b983b6a9fd3079d178b /drivers/net/ucc_geth.c
parent1af7ad51049d6a310a19d497960597198290ddfa (diff)
ucc_geth: Change uec phy id to the same format as gianfar's
The commit b31a1d8b41513b96e9c7ec2f68c5734cef0b26a4 ("gianfar: Convert gianfar to an of_platform_driver") changes the gianfar's phy id to the format like "mdio@xxxx:xx", but uec still uses the old format like "xxxxxxxx:xx". For the board whose UEC uses gianfar-mdio like MPC8568MDS, the phy can not be attached because of the incompatible phy id format. This patch changes uec's phy id to the same format as gianfar's. Signed-off-by: Haiying Wang <Haiying.Wang@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ucc_geth.c')
-rw-r--r--drivers/net/ucc_geth.c20
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)
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;
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}