drivers: net: phy: Ignore PHY ID 0 during PHY probing
Subsystems (2)
PATCH v2 1/1 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 addr.
---
Changes in v2:
- continue with next addr instead of returning NULL right away
- check get_phy_id return code too
drivers/net/phy/phy.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/phy/phy.c +10 -0
@@ -727,12 +727,22 @@ 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 ;
Signature · 1 line
2.17.1
PATCH v2 1/1 drivers: net: phy: Ignore PHY ID 0 during PHY probing
Quoted 22 lines · Alex Marginean
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 addr.Signed-off-by Alex Marginean <[email protected]>Reviewed-by Ramon Fried <[email protected]>---
Changes in v2:
- continue with next addr instead of returning NULL right away
- checkget_phy_idreturn code toodrivers/net/phy/phy.c | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/net/phy/phy.c +0
-0
drivers/net/phy/phy.c static struct phy_device *create_phy_by_mask(struct mii_dev *bus, · line 731
Quoted 5 lines
drivers/net/phy/phy.c +2
-0@@ -727,12 +727,22 @@ 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
nits: missing the changes to the comment format :)
Quoted 7 lines
drivers/net/phy/phy.c +7
-0+* 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; +
drivers/net/phy/phy.c static struct phy_device *create_phy_by_mask(struct mii_dev *bus, · line 748
Quoted 10 lines
drivers/net/phy/phy.c +1
-0/* 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 ;
Other than above,
Regards,
Bin