In case the PHY DT node describes GPIO reset and no other method
of detecting the PHY succeeded, release the PHY from reset using
its reset GPIO before reading out the PHY IDs as a last resort.
This way there is slightly better chance of successful PHY ID
readout.

Signed-off-by: Marek Vasut <marek.vasut+rene...@mailbox.org>
---
Cc: Joe Hershberger <joe.hershber...@ni.com>
Cc: Marek Vasut <marek.vasut+rene...@mailbox.org>
Cc: Michal Simek <michal.si...@amd.com>
Cc: Nishanth Menon <n...@ti.com>
Cc: Ramon Fried <rfried....@gmail.com>
---
 drivers/net/phy/phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 3d69c2c4d28..373006f8206 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -969,7 +969,7 @@ struct phy_device *phy_connect(struct mii_dev *bus, int 
addr,
                phydev = phy_connect_gmii2rgmii(bus, dev);
 #endif
 
-       if (!phydev)
+       if (!phydev && !phy_gpio_reset(dev))
                phydev = phy_find_by_mask(bus, mask);
 
        if (phydev)
-- 
2.39.2

Reply via email to