Re: [PATCH] [v2] fec: convert to gpio descriptor

From: Andrew Lunn
Date: Tue Jan 31 2023 - 12:25:52 EST


On Tue, Jan 31, 2023 at 04:38:51PM +0100, Marc Kleine-Budde wrote:
> On 26.01.2023 22:05:59, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@xxxxxxxx>
> >
> > The driver can be trivially converted, as it only triggers the gpio
> > pin briefly to do a reset, and it already only supports DT.
> >
> > Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
>
> On current net-next/main 6a8ab436831d ("Merge branch
> 'add-support-for-the-the-vsc7512-internal-copper-phys'") this causes the
> riot board (arch/arm/boot/dts/imx6dl-riotboard.dts) to not probe the
> fec:
>
> | Jan 31 16:32:12 riot kernel: fec 2188000.ethernet: error -ENOENT: failed to get phy-reset-gpios
> | Jan 31 16:32:12 riot kernel: fec: probe of 2188000.ethernet failed with error -2

Hi Marc

Could you try swapping the devm_gpiod_get() for
devm_gpiod_get_optional().

It is kind of hidden, but:

- else if (!gpio_is_valid(phy_reset))
- return 0;

made the GPIO optional, since -2 is not a valid GPIO number and so it
would silently return.

The real fix will need to be a bit more complex, since we don't want
to do the sleeps etc if the GPIO is not present.

Andrew