Re: [PATCH net] net: phy: mdio_device: leave PHY reset deasserted on unregister
From: Leonardo Mörlein
Date: Sat Jun 06 2026 - 08:03:29 EST
On Thursday, May 21st, 2026 at 1:39 AM, Andrew Lunn <andrew@xxxxxxx> wrote:
> Can we take a step back, and look at your actual hardware. What is the
> state of the hardware when Linux boots, but before the MDIO bus is
> enumerated?
>
> Is the GPIO is configured as an input, and there is a resistor keeping
> the PHY out of reset?
I tried to check the state input/output state of the GPIO before the kernel
initializes it by using the GPIOD_ASIS flag.
Unfortunately, the xway pinctrl gpio driver does not seem to implement
get_direction() here:
https://elixir.bootlin.com/linux/v7.0.11/source/drivers/pinctrl/pinctrl-xway.c#L1352
Therefore, the only thing that I can tell is that the level of the gpio is
corresponding to "reset not asserted" before the kernel starts to initialize
the GPIO and I could not get information if it is an input or output this
way.
> Maybe when we probe the PHY we need to ask the GPIO subsystem how the
> GPIO is configured. On unregistered of the PHY we need to put the GPIO
> back into that state?
I like the idea that our code should take the responsibility to bring
devices into a defined state that works for us irrespective of which the
state the hardware was left in before (by whoever).
Turning it into an output and controlling its level is the thing that
currently feels the most simple to me. Especially respecting the fact
that not every GPIO driver seems to allows to query it's full state.
I think, this also the direction in which Buday Csaba is arguing. I will
respond to his mail in a separate reply.
Cheers,
Leonardo