[PATCH 2/2] net: phy: Release PHY from GPIO reset if applicable

Marek Vasut marek.vasut+renesas at mailbox.org
Tue Jun 20 00:45:55 CEST 2023


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+renesas at mailbox.org>
---
Cc: Joe Hershberger <joe.hershberger at ni.com>
Cc: Marek Vasut <marek.vasut+renesas at mailbox.org>
Cc: Michal Simek <michal.simek at amd.com>
Cc: Nishanth Menon <nm at ti.com>
Cc: Ramon Fried <rfried.dev at 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



More information about the U-Boot mailing list