Skip to content

Commit

Permalink
net: mv643xx_eth: use of_phy_connect if phy_node present
Browse files Browse the repository at this point in the history
This connects to a phy node passed to the port device instead of probing
the phy by phy_addr.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Sebastian Hesselbarth authored and David S. Miller committed May 31, 2013
1 parent 5f29235 commit cc9d459
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions drivers/net/ethernet/marvell/mv643xx_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/clk.h>
#include <linux/of_mdio.h>

static char mv643xx_eth_driver_name[] = "mv643xx_eth";
static char mv643xx_eth_driver_version[] = "1.4";
Expand Down Expand Up @@ -2715,17 +2716,27 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
netif_set_real_num_tx_queues(dev, mp->txq_count);
netif_set_real_num_rx_queues(dev, mp->rxq_count);

if (pd->phy_addr != MV643XX_ETH_PHY_NONE) {
err = 0;
if (pd->phy_node) {
mp->phy = of_phy_connect(mp->dev, pd->phy_node,
mv643xx_eth_adjust_link, 0,
PHY_INTERFACE_MODE_GMII);
if (!mp->phy)
err = -ENODEV;
} else if (pd->phy_addr != MV643XX_ETH_PHY_NONE) {
mp->phy = phy_scan(mp, pd->phy_addr);

if (IS_ERR(mp->phy)) {
if (IS_ERR(mp->phy))
err = PTR_ERR(mp->phy);
if (err == -ENODEV)
err = -EPROBE_DEFER;
goto out;
}
phy_init(mp, pd->speed, pd->duplex);
else
phy_init(mp, pd->speed, pd->duplex);
}
if (err == -ENODEV) {
err = -EPROBE_DEFER;
goto out;
}
if (err)
goto out;

SET_ETHTOOL_OPS(dev, &mv643xx_eth_ethtool_ops);

Expand Down

0 comments on commit cc9d459

Please sign in to comment.