Re: [PATCH net] net: phy: mdio_device: leave PHY reset deasserted on unregister
From: Andrew Lunn
Date: Wed May 20 2026 - 12:04:25 EST
On Wed, May 20, 2026 at 03:13:59PM +0000, leo.moerlein@xxxxxxxxx wrote:
> From: Leonardo Mörlein <leo.moerlein@xxxxxxxxx>
>
> Some PHY devices are discovered again after the MDIO bus is torn down and
> reprobed, for example when a parent driver first returns -EPROBE_DEFER and
> is probed again later.
>
> This breaks boards where external PHYs have per-device reset lines
> described through reset-gpios. mdiobus_register_device() acquires the
> reset GPIO and asserts reset, mdio_probe() later deasserts it for the
> active device, but mdiobus_unregister_device() used to release the GPIO
> descriptor without first driving the line back to the inactive state.
> If that descriptor was the last owner, then the PHY could remain held
> in reset across the next bus registration and disappear from the reprobe
> scan.
I'm wondering if we are fixing the wrong thing here.
Rather than take it out of reset, should it not be put into reset? I
assume the bootloader is taking it out of reset?
Or does it have a pullup/down so if the GPIO defaults as an input/HiZ,
it defaults out of reset? When the GPIO is unregistered, are we
leaving it as an output?
Andrew