Re: [PATCH net] net: phy: mdio_device: leave PHY reset deasserted on unregister

From: Buday Csaba

Date: Thu May 21 2026 - 04:59:03 EST


>> I'm wondering if we are fixing the wrong thing here.
>
> In general, I see two options to fix this. Either we fix the
> tear down or we fix the setup of the device.

I have been fighting a different problem with a similar cause.

- you should not rely on the bootloader setting anything up. The kernel
should be able to perform the initialization without any assumptions
about bootloader OR previous state behavior.
- from this follows, that the correct way to handle resets is always
during the initialization, not leaving it in a known state.
- mdio_unregister_device() should reverse mdiobus_register_device().
The reset was in an unknown state before mdiobus_register_device(),
so both can be argued:
a) you can leave it in either state, since it was not determined
before
b) you should leave it asserted, to save power

If I understand correctly, your resets are asserted by default (when the
GPIOs are inputs).

I have sent patches that would have taken control of resets before
the device is established, but there were problems with that.
It would have served a different purpose (PHY ID autodetection), but I
think if implemented correctly, it would also help your situation.
Russell King replied with a constructive letter, but I lacked the time
since to do anything on that thread.

See:
https://lore.kernel.org/all/5701a9faafd1769b650b79c2d0c72cc10b5bdbc8.1764337894.git.buday.csaba@xxxxxxxxx/#t

Please also check out this letter by Andrew about the PHY ID autodetection:

https://lore.kernel.org/netdev/23c1bed1-3f95-48b9-8ff0-71696bdcd62b@xxxxxxx/

Perhaps specifying the PHY ID would help? It did help me.

Regards,
Csaba