diff options
Diffstat (limited to 'drivers/net/ethernet/freescale/fec_main.c')
-rw-r--r-- | drivers/net/ethernet/freescale/fec_main.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 816e6ae63e5b..489b9de1575f 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
@@ -1447,18 +1447,23 @@ static int fec_enet_mii_probe(struct net_device *ndev) | |||
1447 | fep->phy_dev = NULL; | 1447 | fep->phy_dev = NULL; |
1448 | 1448 | ||
1449 | /* check for attached phy */ | 1449 | /* check for attached phy */ |
1450 | for (phy_id = 0; (phy_id < PHY_MAX_ADDR); phy_id++) { | 1450 | if (IS_ERR(&fep->phy_id) || fep->phy_id >= PHY_MAX_ADDR || |
1451 | if ((fep->mii_bus->phy_mask & (1 << phy_id))) | 1451 | fep->mii_bus->phy_mask & (1 << fep->phy_id)) { |
1452 | continue; | 1452 | for (phy_id = 0; (phy_id < PHY_MAX_ADDR); phy_id++) { |
1453 | if (fep->mii_bus->phy_map[phy_id] == NULL) | 1453 | if ((fep->mii_bus->phy_mask & (1 << phy_id))) |
1454 | continue; | 1454 | continue; |
1455 | if (fep->mii_bus->phy_map[phy_id]->phy_id == 0) | 1455 | if (fep->mii_bus->phy_map[phy_id] == NULL) |
1456 | continue; | 1456 | continue; |
1457 | if (dev_id--) | 1457 | if (fep->mii_bus->phy_map[phy_id]->phy_id == 0) |
1458 | continue; | 1458 | continue; |
1459 | strncpy(mdio_bus_id, fep->mii_bus->id, MII_BUS_ID_SIZE); | 1459 | if (dev_id--) |
1460 | break; | 1460 | continue; |
1461 | break; | ||
1462 | } | ||
1463 | } else { | ||
1464 | phy_id = fep->phy_id; | ||
1461 | } | 1465 | } |
1466 | strncpy(mdio_bus_id, fep->mii_bus->id, MII_BUS_ID_SIZE); | ||
1462 | 1467 | ||
1463 | if (phy_id >= PHY_MAX_ADDR) { | 1468 | if (phy_id >= PHY_MAX_ADDR) { |
1464 | netdev_info(ndev, "no PHY, assuming direct connection to switch\n"); | 1469 | netdev_info(ndev, "no PHY, assuming direct connection to switch\n"); |
@@ -2628,6 +2633,7 @@ fec_probe(struct platform_device *pdev) | |||
2628 | platform_set_drvdata(pdev, ndev); | 2633 | platform_set_drvdata(pdev, ndev); |
2629 | 2634 | ||
2630 | fec_of_init(pdev); | 2635 | fec_of_init(pdev); |
2636 | of_property_read_u32(pdev->dev.of_node, "phy-id", &fep->phy_id); | ||
2631 | ret = of_get_phy_mode(pdev->dev.of_node); | 2637 | ret = of_get_phy_mode(pdev->dev.of_node); |
2632 | if (ret < 0) { | 2638 | if (ret < 0) { |
2633 | pdata = pdev->dev.platform_data; | 2639 | pdata = pdev->dev.platform_data; |