On 9/9/26 19:18, Graeme Smecher wrote:
eth_phy_of_to_plat() claims the PHY reset GPIO with
gpio_request_by_name(), but nothing releases the claim when the device
is removed. When retrying a wedged PHY, any follow-up probes fail
because the GPIO has already been claimed.

Signed-off-by: Graeme Smecher <[email protected]>
---
Changes in v2:
- None

  drivers/net/eth-phy-uclass.c | 14 ++++++++++++++
  1 file changed, 14 insertions(+)

diff --git a/drivers/net/eth-phy-uclass.c b/drivers/net/eth-phy-uclass.c
index 1dae26878e6..e93a358a2a6 100644
--- a/drivers/net/eth-phy-uclass.c
+++ b/drivers/net/eth-phy-uclass.c
@@ -181,11 +181,25 @@ static int eth_phy_pre_probe(struct udevice *dev)
        return 0;
  }
+static int eth_phy_pre_remove(struct udevice *dev)
+{
+       struct eth_phy_device_priv *uc_priv = dev_get_uclass_priv(dev);
+
+       if (!CONFIG_IS_ENABLED(DM_GPIO))
+               return 0;
+
+       if (dm_gpio_is_valid(&uc_priv->reset_gpio))
+               dm_gpio_free(dev, &uc_priv->reset_gpio);
+

don't you also want to call reset_free() when you are touching this?

M

Reply via email to