[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3z5dtqwwxhx6ogtztlsdwvlbxmt5ujbj7pme2delou7mqsnsll@esfwyr2glzyn>
Date: Tue, 7 Jan 2025 23:14:27 +0100
From: Jörg Sommer <joerg@...so.de>
To: Pieter Van Trappen <pieter.van.trappen@...n.ch>
Cc: Christian Eggers <ceggers@...i.de>, Jakub Kicinski <kuba@...nel.org>,
Tristram Ha <tristram.ha@...rochip.com>, Woojung Huh <Woojung.Huh@...rochip.com>, netdev@...r.kernel.org,
linux-spi@...r.kernel.org, Andrew Lunn <andrew@...n.ch>
Subject: Re: KSZ8795 not detected at start to boot from NFS
Pieter Van Trappen schrieb am Mo 06. Jan, 14:38 (+0100):
> On 05/01/2025 18:08, Andrew Lunn wrote:
> > On Sun, Jan 05, 2025 at 05:33:38PM +0100, Jörg Sommer wrote:
> > > Hi everyone,
> > >
> > > I've added you to the list of recipients, because you where somehow involved
> > > in changes of the KSZ-SPI switch code.
> > >
> > > We are debating the SPI mode setting for the microchip ksz8795 and ksz9477
> > > and possibly others. Since the commit
> > > 8c4599f49841dd663402ec52325dc2233add1d32 the SPI mode gets fixed to mode 3
> > > in the code. But at least my ksz8795 works also with mode 0 and shows better
> > > initialization behaviour with mode 0.
> > >
> > > The big question is: can both (or all ksz) chips work with both modes?
> > > Should this setting stay in code or moved to the device tree?
> > >
> > > The specs are here, but I found no evidence about the supported/recommended
> > > SPI modes:
> > >
> > > https://ww1.microchip.com/downloads/en/DeviceDoc/KSZ9563R-Data-Sheet-DS00002419D.pdf
>
> From this KSZ9563 datasheet it is quite clear from Figure 6-9 that it
> requires mode 0, for KSZ8794 (which I have and can test) Figure 7-8 [1] also
> indicates mode 0. Note however that older KSZ8794 datasheets (revision
> DS00002134A from 2016, can upload if needed) rather indicate a mode 3, which
> is a hint to me that indeed both modes were once supported. Appendix A from
> [1] states that in 2021 the SPI Timing images and parameters have been
> updated. No further information there but your experience and the datasheet
> update seem to indicate mode 0 has better support.
The ksz8795 spec [2] says on page 53, table 4-3, register 11, bit 0 “Trigger
on the rising edge of SPI clock (for higher speed SPI)”. The rising edge
should mean SPI mode 0. So mode 0 should be recommended for higher speed.
[2] https://ww1.microchip.com/downloads/aemDocuments/documents/UNG/ProductDocuments/DataSheets/KSZ8795CLX-Data-Sheet-DS00002112.pdf
> My SPI peripheral (and KSZ8 driver) is configured for mode 3 I see but the
> frequency is set to 10 MHz while the max is 50 MHz. From experience with
> other SPI devices I know that with higher frequencies the timing parameters
> (setup and hold times, mode) become more important, what frequency do you
> have configured Jörg? I'm asking because I don't experience the issue you
> have.
>
> [1]
> https://ww1.microchip.com/downloads/aemDocuments/documents/UNG/ProductDocuments/DataSheets/KSZ8794CNX-Data-Sheet-DS00002134.pdf
I am using 25MHz which is the maximum for the ksz8795; see [2] page 11,
table 2-1, pin 67; page 27, sec "3.5.1.1 SPI Client Serial Bus
Configuration"
I've tried 10MHz with the code in place that switches to SPI mode 3, but I
still get:
[ 2.078732] ksz8795-switch spi0.1: invalid family id: 0
[ 2.078808] ksz8795-switch: probe of spi0.1 failed with error -22
I think the main problem is that the chip needs a read access to
detect/adjust itself to the new mode. If this is the read for the chip id,
this fails.
I'm in favour of removing the code, and leave it up to the devicetree to
make the decision. Maybe add a note to micrel-ks8995.txt that spi-cpha and
spi-cpol are possible.
diff --git drivers/net/dsa/microchip/ksz_spi.c drivers/net/dsa/microchip/ksz_spi.c
index 108a958dc356..046f2a7d1e08 100644
--- drivers/net/dsa/microchip/ksz_spi.c
+++ drivers/net/dsa/microchip/ksz_spi.c
@@ -85,12 +85,6 @@ static int ksz_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;
-
dev->irq = spi->irq;
ret = ksz_switch_register(dev);
Regards, Jörg
--
»Das ist wie mit allen Löschfunktionen im Internet: Du kannst Dir nur
sichern seien, dass es auf Deinem Rechner verschwunden ist. An alle
anderen ist es eine Bitte.«
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists