Commit eedbc705 authored by Anton Vorontsov's avatar Anton Vorontsov Committed by David S. Miller

fs_enet: Revive fixed link support

Since commit aa73832c ("Rework
fs_enet driver to use of_mdio infrastructure") the fixed-link support
is broken in the fs_enet driver.

This patch fixes the support by removing a check for phy_node, and adding
a call to of_phy_connect_fixed_link().

Also set netdev parent device via SET_NETDEV_DEV() call, this is needed
so that OF MDIO core could find a node pointer for a device.

Plus, fix "if (IS_ERR(phydev))" check, in case of errors,
of_phy_connect() returns NULL, not ERR_PTR as phy_connect().
Signed-off-by: default avatarAnton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 24c30dbb
...@@ -754,17 +754,16 @@ static int fs_init_phy(struct net_device *dev) ...@@ -754,17 +754,16 @@ static int fs_init_phy(struct net_device *dev)
fep->oldlink = 0; fep->oldlink = 0;
fep->oldspeed = 0; fep->oldspeed = 0;
fep->oldduplex = -1; fep->oldduplex = -1;
if(fep->fpi->phy_node)
phydev = of_phy_connect(dev, fep->fpi->phy_node, phydev = of_phy_connect(dev, fep->fpi->phy_node, &fs_adjust_link, 0,
&fs_adjust_link, 0, PHY_INTERFACE_MODE_MII);
PHY_INTERFACE_MODE_MII); if (!phydev) {
else { phydev = of_phy_connect_fixed_link(dev, &fs_adjust_link,
printk("No phy bus ID specified in BSP code\n"); PHY_INTERFACE_MODE_MII);
return -EINVAL;
} }
if (IS_ERR(phydev)) { if (!phydev) {
printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); dev_err(&dev->dev, "Could not attach to PHY\n");
return PTR_ERR(phydev); return -ENODEV;
} }
fep->phydev = phydev; fep->phydev = phydev;
...@@ -1005,6 +1004,7 @@ static int __devinit fs_enet_probe(struct of_device *ofdev, ...@@ -1005,6 +1004,7 @@ static int __devinit fs_enet_probe(struct of_device *ofdev,
goto out_free_fpi; goto out_free_fpi;
} }
SET_NETDEV_DEV(ndev, &ofdev->dev);
dev_set_drvdata(&ofdev->dev, ndev); dev_set_drvdata(&ofdev->dev, ndev);
fep = netdev_priv(ndev); fep = netdev_priv(ndev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment