[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a578b29f-53f0-4e33-91a4-3932fa759cd1@lunn.ch>
Date: Sat, 7 Dec 2024 21:47:31 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Jörg Sommer <joerg@...so.de>
Cc: netdev@...r.kernel.org, Christian Eggers <ceggers@...i.de>
Subject: Re: KSZ8795 not detected at start to boot from NFS
On Sat, Dec 07, 2024 at 08:53:38AM +0100, Jörg Sommer wrote:
> Hi,
>
> I'm trying to load the root filesystem via NFS with a
> NET_DSA_MICROCHIP_KSZ8795_SPI attached to an TI_DAVINCI_EMAC. With 5.10 it
> works, but with later versions the kernel fails to detect the switch. It is
> since
>
> commit 8c4599f49841dd663402ec52325dc2233add1d32
> Author: Christian Eggers <ceggers@...i.de>
> Date: Fri Nov 20 12:21:07 2020 +0100
>
> net: dsa: microchip: ksz8795: setup SPI mode
>
> This should be done in the device driver instead of the device tree.
>
> Signed-off-by: Christian Eggers <ceggers@...i.de>
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
>
> diff --git drivers/net/dsa/microchip/ksz8795_spi.c drivers/net/dsa/microchip/ksz8795_spi.c
> index 8b00f8e6c02f..f98432a3e2b5 100644
> --- drivers/net/dsa/microchip/ksz8795_spi.c
> +++ drivers/net/dsa/microchip/ksz8795_spi.c
> @@ -49,6 +49,12 @@ static int ksz8795_spi_probe(struct spi_device *spi)
> if (spi->dev.platform_data)
> dev->pdata = spi->dev.platform_data;
>
> + /* setup spi */
> + spi->mode = SPI_MODE_3;
> + ret = spi_setup(spi);
> + if (ret)
> + return ret;
> +
> ret = ksz8795_switch_register(dev);
>
> /* Main DSA driver may not be started yet. */
>
> The kernel reports
>
> [ 1.912756] ksz8795-switch: probe of spi0.1 failed with error -22
> …
> [ 2.048054] davinci_emac 1e20000.ethernet: incompatible machine/device type for reading mac address
> [ 2.062352] davinci_emac davinci_emac.1: failed to get EMAC clock
> [ 2.068632] davinci_emac: probe of davinci_emac.1 failed with error -16
>
> It tries to initialize the switch before the ethernet of the SoC is ready.
>
> Before this commit the kernel returned EPROBE_DEFER instead of EINVAL (or
> ENODEV) as a quick
This is often true for DSA switches, that the first probe fails with
EPROBE_DEFER, because the conduit ethernet is not ready.
What i don't understand from your description is why:
> + /* setup spi */
> + spi->mode = SPI_MODE_3;
> + ret = spi_setup(spi);
> + if (ret)
> + return ret;
> +
is causing this issue. Is spi_setup() failing?
Andrew
Powered by blists - more mailing lists