The Aeonsemi PHYs report a generic PHY ID until their firmware is loaded, so the driver reads the ID from the hardware while matching instead of relying on the ID cached at bus scan time. The PHY only reports a valid ID while out of reset, which is not guaranteed. phy_remove() asserts the reset and phy_probe() deasserts it, but probing only happens once a driver has matched. Rebinding the driver, for instance by reloading the module, therefore reads the ID of a PHY held in reset. This fails to match, leaving the PHY in reset with no driver bound, which cannot be recovered without a power cycle. Deassert the reset before reading the ID. mdio_device_reset() keeps track of the reset state, so this does nothing when the PHY has no reset described or is already out of reset. Since the PHY comes out of reset with its firmware unloaded, it reports the generic PHY ID again and the existing firmware loading path handles it. If no driver matches, the PHY is left out of reset, just as after phy_device_register(). Fixes: 830877d89edc ("net: phy: Add support for Aeonsemi AS21xxx PHYs") Signed-off-by: Cristian Ciocaltea --- drivers/net/phy/as21xxx.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/phy/as21xxx.c b/drivers/net/phy/as21xxx.c index 5eea6baa75bf..761458c606a2 100644 --- a/drivers/net/phy/as21xxx.c +++ b/drivers/net/phy/as21xxx.c @@ -1196,6 +1196,12 @@ static int as21xxx_match_phy_device(struct phy_device *phydev, PHY_VENDOR_AEONSEMI)) return genphy_match_phy_device(phydev, phydrv); + /* phy_remove() leaves the PHY in reset and only phy_probe() releases + * it, so release it here to be able to read the ID on rebind. No-op + * if there is no reset or it is already released. + */ + phy_device_reset(phydev, 0); + /* Read PHY ID to handle firmware loaded or HW reset */ ret = phy_read_mmd(phydev, MDIO_MMD_PCS, MII_PHYSID1); if (ret < 0) -- 2.56.0