diff options
-rw-r--r-- | Documentation/devicetree/bindings/net/fsl-fec.txt | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/freescale/fec.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/freescale/fec_main.c | 28 |
3 files changed, 19 insertions, 11 deletions
diff --git a/Documentation/devicetree/bindings/net/fsl-fec.txt b/Documentation/devicetree/bindings/net/fsl-fec.txt index 9a86d04d5126..303141018d81 100644 --- a/Documentation/devicetree/bindings/net/fsl-fec.txt +++ b/Documentation/devicetree/bindings/net/fsl-fec.txt @@ -10,6 +10,7 @@ Required properties: Optional properties: - local-mac-address : 6 bytes, mac address +- phy-id : The property is to specify the static phy address - phy-reset-gpios : Should specify the gpio for phy reset - phy-reset-duration : Reset duration in milliseconds. Should present only if property "phy-reset-gpios" is available. Missing the property diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h index 12c8352900b2..b59992a2d52e 100644 --- a/drivers/net/ethernet/freescale/fec.h +++ b/drivers/net/ethernet/freescale/fec.h @@ -573,6 +573,7 @@ struct fec_enet_private { struct phy_device *phy_dev; int mii_timeout; uint phy_speed; + uint phy_id; phy_interface_t phy_interface; int link; int full_duplex; 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) fep->phy_dev = NULL; /* check for attached phy */ - for (phy_id = 0; (phy_id < PHY_MAX_ADDR); phy_id++) { - if ((fep->mii_bus->phy_mask & (1 << phy_id))) - continue; - if (fep->mii_bus->phy_map[phy_id] == NULL) - continue; - if (fep->mii_bus->phy_map[phy_id]->phy_id == 0) - continue; - if (dev_id--) - continue; - strncpy(mdio_bus_id, fep->mii_bus->id, MII_BUS_ID_SIZE); - break; + if (IS_ERR(&fep->phy_id) || fep->phy_id >= PHY_MAX_ADDR || + fep->mii_bus->phy_mask & (1 << fep->phy_id)) { + for (phy_id = 0; (phy_id < PHY_MAX_ADDR); phy_id++) { + if ((fep->mii_bus->phy_mask & (1 << phy_id))) + continue; + if (fep->mii_bus->phy_map[phy_id] == NULL) + continue; + if (fep->mii_bus->phy_map[phy_id]->phy_id == 0) + continue; + if (dev_id--) + continue; + break; + } + } else { + phy_id = fep->phy_id; } + strncpy(mdio_bus_id, fep->mii_bus->id, MII_BUS_ID_SIZE); if (phy_id >= PHY_MAX_ADDR) { netdev_info(ndev, "no PHY, assuming direct connection to switch\n"); @@ -2628,6 +2633,7 @@ fec_probe(struct platform_device *pdev) platform_set_drvdata(pdev, ndev); fec_of_init(pdev); + of_property_read_u32(pdev->dev.of_node, "phy-id", &fep->phy_id); ret = of_get_phy_mode(pdev->dev.of_node); if (ret < 0) { pdata = pdev->dev.platform_data; |