Re: [PATCH 00/12] Rework PHY reset handling
From: Andrew Lunn
Date: Wed Apr 05 2023 - 08:32:34 EST
On Wed, Apr 05, 2023 at 11:26:51AM +0200, Marco Felsch wrote:
> The current phy reset handling is broken in a way that it needs
> pre-running firmware to setup the phy initially. Since the very first
> step is to readout the PHYID1/2 registers before doing anything else.
>
> The whole dection logic will fall apart if the pre-running firmware
> don't setup the phy accordingly or the kernel boot resets GPIOs states
> or disables clocks. In such cases the PHYID1/2 read access will fail and
> so the whole detection will fail.
>
> I fixed this via this series, the fix will include a new kernel API
> called phy_device_atomic_register() which will do all necessary things
> and return a 'struct phy_device' on success. So setting up a phy and the
> phy state machine is more convenient.
Please add a section explaining why the current API is broken beyond
repair. You need to justify adding a new call, rather than fixing the
existing code to just do what is necessary to allow the PHY to be
found.
Andrew