diff options
author | Alex Marginean <alexm.osslist@gmail.com> | 2019-07-05 12:28:55 +0300 |
---|---|---|
committer | Joe Hershberger <joe.hershberger@ni.com> | 2019-07-18 16:37:13 -0500 |
commit | 3bf135b6c367ec67258a67eefbe1eeb7b984e12d (patch) | |
tree | 9e7aaba3ed0989877ae390ffb953d73e66fb8018 /drivers/net | |
parent | 14df216d10c025de223556c01087994716691e9b (diff) | |
download | u-boot-3bf135b6c367ec67258a67eefbe1eeb7b984e12d.tar.gz u-boot-3bf135b6c367ec67258a67eefbe1eeb7b984e12d.tar.bz2 u-boot-3bf135b6c367ec67258a67eefbe1eeb7b984e12d.zip |
drivers: net: phy: Ignore PHY ID 0 during PHY probing
Current code fails to probe some C45 PHYs that also respond to C22 reads.
This is the case for PHYs like Aquantia AQR112, Marvell 88X2242 (as
previously posted on the u-boot list).
If the PHY ID reads all 0s just ignore it and try the next devad.
Signed-off-by: Alex Marginean <alexm.osslist@gmail.com>
Reviewed-By: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/phy/phy.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index c1c1af9abd..ae37dd6c1e 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -727,12 +727,23 @@ static struct phy_device *create_phy_by_mask(struct mii_dev *bus, while (phy_mask) { int addr = ffs(phy_mask) - 1; int r = get_phy_id(bus, addr, devad, &phy_id); + + /* + * If the PHY ID is flat 0 we ignore it. There are C45 PHYs + * that return all 0s for C22 reads (like Aquantia AQR112) and + * there are C22 PHYs that return all 0s for C45 reads (like + * Atheros AR8035). + */ + if (r == 0 && phy_id == 0) + goto next; + /* If the PHY ID is mostly f's, we didn't find anything */ if (r == 0 && (phy_id & 0x1fffffff) != 0x1fffffff) { is_c45 = (devad == MDIO_DEVAD_NONE) ? false : true; return phy_device_create(bus, addr, phy_id, is_c45, interface); } +next: phy_mask &= ~(1 << addr); } return NULL; |