[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <njdcvcha6n3chy2ldrf2ghnj5brgqxqujrk4trp5wyo6jvpo6c@b3qdubsvg6ko>
Date: Tue, 10 Dec 2024 17:43:01 +0100
From: Jörg Sommer <joerg@...so.de>
To: Christian Eggers <ceggers@...i.de>
Cc: Andrew Lunn <andrew@...n.ch>, netdev@...r.kernel.org
Subject: Re: KSZ8795 not detected at start to boot from NFS
Jörg Sommer schrieb am So 08. Dez, 17:44 (+0100):
> Christian Eggers schrieb am Sa 07. Dez, 23:44 (+0100):
> > On Saturday, 7 December 2024, 21:47:31 CET, Andrew Lunn wrote:
> > > 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?
> >
> > On Saturday, 7 December 2024, 22:07:23 CET, Jörg Sommer wrote:
> >
> > > I've added another dev_err() after the spi_setup:
> > >
> > > [ 1.680516] ksz8795-switch spi0.1: ksz8795_spi_probe:55: ret of spi_setup=0
> > > [ 1.819194] ksz8795-switch spi0.1: ksz8795_spi_probe:61: ret=-22#
Hi Christian,
I've changed the code for debugging to this:
{
u16 id16;
ret = ksz_read16(dev, 0x00, &id16);
dev_err(&spi->dev, "%s:%d: ksz_read16(REG_CHIP_ID0, %d) = %d\n",
__func__, __LINE__, id16, ret);
}
/* setup spi */
dev_err(&spi->dev, "Switching SPI mode from %d to spi-cpha,spi-cpol\n",
spi->mode);
spi->mode = SPI_MODE_3;
ret = spi_setup(spi);
if (ret)
return ret;
{
u16 id16;
ret = ksz_read16(dev, 0x00, &id16);
dev_err(&spi->dev, "%s:%d: ksz_read16(REG_CHIP_ID0, %d) = %d\n",
__func__, __LINE__, id16, ret);
}
ret = ksz8_switch_register(dev);
dev_err(&spi->dev, "ksz8795_spi_probe:%d: ret=%d\n", __LINE__, ret);
if (ret == -EINVAL || ret == -ENODEV)
ret = -EPROBE_DEFER;
With a devicetree without spi-cpha, spi-cpol I get this:
[ 1.751347] ksz8795-switch spi0.1: ksz8795_spi_probe:76: ksz_read16(REG_CHIP_ID0, 34705) = 0
[ 1.751445] ksz8795-switch spi0.1: Switching SPI mode from 0 to spi-cpha,spi-cpol
[ 1.752226] ksz8795-switch spi0.1: ksz8795_spi_probe:91: ksz_read16(REG_CHIP_ID0, 0) = 0
[ 1.889370] ksz8795-switch spi0.1: ksz8795_spi_probe:97: ret=-517
[ 1.891431] ksz8795-switch spi0.1: ksz8795_spi_probe:76: ksz_read16(REG_CHIP_ID0, 34705) = 0
[ 1.891525] ksz8795-switch spi0.1: Switching SPI mode from 3 to spi-cpha,spi-cpol
[ 1.892282] ksz8795-switch spi0.1: ksz8795_spi_probe:91: ksz_read16(REG_CHIP_ID0, 34705) = 0
[ 2.034994] ksz8795-switch spi0.1: ksz8795_spi_probe:97: ret=-517
[ 2.043130] ksz8795-switch spi0.1: ksz8795_spi_probe:76: ksz_read16(REG_CHIP_ID0, 34705) = 0
[ 2.043217] ksz8795-switch spi0.1: Switching SPI mode from 3 to spi-cpha,spi-cpol
[ 2.043957] ksz8795-switch spi0.1: ksz8795_spi_probe:91: ksz_read16(REG_CHIP_ID0, 34705) = 0
[ 2.187793] ksz8795-switch spi0.1: ksz8795_spi_probe:97: ret=-517
[ 2.195915] davinci_emac 1e20000.ethernet: incompatible machine/device type for reading mac address
[ 2.207703] ksz8795-switch spi0.1: ksz8795_spi_probe:76: ksz_read16(REG_CHIP_ID0, 34705) = 0
[ 2.207795] ksz8795-switch spi0.1: Switching SPI mode from 3 to spi-cpha,spi-cpol
[ 2.208554] ksz8795-switch spi0.1: ksz8795_spi_probe:91: ksz_read16(REG_CHIP_ID0, 34705) = 0
[ 4.212102] ksz8795-switch spi0.1: configuring for fixed/rmii link mode
[ 4.219662] ksz8795-switch spi0.1: Link is Up - 100Mbps/Full - flow control rx/tx
The immediate read after the spi_setup reports `0` for the chip ID.
If I comment the second block, this brings the -22 which stops further
probing (if not mangled by by EINVAL → EPROBE_DEFER).
[ 1.712445] ksz8795-switch spi0.1: ksz8795_spi_probe:76: ksz_read16(REG_CHIP_ID0, 34705) = 0
[ 1.712545] ksz8795-switch spi0.1: Switching SPI mode from 0 to spi-cpha,spi-cpol
[ 1.851109] ksz8795-switch spi0.1: invalid family id: 0
[ 1.851192] ksz8795-switch spi0.1: ksz8795_spi_probe:97: ret=-22
[ 1.853241] ksz8795-switch spi0.1: ksz8795_spi_probe:76: ksz_read16(REG_CHIP_ID0, 34705) = 0
[ 1.853336] ksz8795-switch spi0.1: Switching SPI mode from 3 to spi-cpha,spi-cpol
[ 1.992243] ksz8795-switch spi0.1: ksz8795_spi_probe:97: ret=-517
[ 1.994767] ksz8795-switch spi0.1: ksz8795_spi_probe:76: ksz_read16(REG_CHIP_ID0, 34705) = 0
[ 1.994860] ksz8795-switch spi0.1: Switching SPI mode from 3 to spi-cpha,spi-cpol
[ 2.128827] ksz8795-switch spi0.1: ksz8795_spi_probe:97: ret=-517
[ 2.140263] davinci_emac 1e20000.ethernet: incompatible machine/device type for reading mac address
[ 2.148743] ksz8795-switch spi0.1: ksz8795_spi_probe:76: ksz_read16(REG_CHIP_ID0, 34705) = 0
[ 2.148836] ksz8795-switch spi0.1: Switching SPI mode from 3 to spi-cpha,spi-cpol
[ 4.145963] ksz8795-switch spi0.1: configuring for fixed/rmii link mode
[ 4.146161] ksz8795-switch spi0.1: Link is Up - 100Mbps/Full - flow control rx/tx
So I think it's a timing problem: the ksz8795 isn't ready after the SPI
reset, when the chip ID gets read, and this causes the probing to stop.
Why is SPI_MODE_3 required? At me, the chip works fine with SPI_MODE_0.
Regards, Jörg
--
> Ich kenn mich mit OpenBSD kaum aus, was sind denn da so die
> Vorteile gegenueber Linux und iptables?
Der Fuchsschwanzeffekt ist größer. :->
Message-ID: <slrnb11064.54g.hschlen@...bert.ddns.org>
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists