[PATCH 2/2] net: eth-phy: prevent undesired de-assertion of phy-reset on request

Tim Harvey tharvey at gateworks.com
Tue Mar 1 21:15:02 CET 2022


When gpio_request_by_name allocates a gpio output it by default will
de-assert the gpio which for phy-reset will take the PHY out of reset.
As this occurs before eth_phy_reset is called to assert the reset
line it can cause undesired affects if reset timings are not properly
met.

Configure the gpio with GPIOD_IS_OUT_ACTIVE so that reset is kept active
(reset asserted) to avoid this.

Cc: Sean Anderson <sean.anderson at seco.com>
Signed-off-by: Tim Harvey <tharvey at gateworks.com>
---
 drivers/net/eth-phy-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/eth-phy-uclass.c b/drivers/net/eth-phy-uclass.c
index 1f285f7afd20..27b77444a0c5 100644
--- a/drivers/net/eth-phy-uclass.c
+++ b/drivers/net/eth-phy-uclass.c
@@ -137,7 +137,7 @@ static int eth_phy_of_to_plat(struct udevice *dev)
 	/* search "reset-gpios" in phy node */
 	ret = gpio_request_by_name(dev, "reset-gpios", 0,
 				   &uc_priv->reset_gpio,
-				   GPIOD_IS_OUT);
+				   GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE);
 	if (ret && ret != -ENOENT)
 		return ret;
 
-- 
2.17.1



More information about the U-Boot mailing list