Hi Stefan,
thank you for your prompt answer.

You are right: 50Mhz is a high spi speed. In the data sheet from Spansion chip 
is 
described: "Normal READ 40Mhz, Fast READ 104MHz.

But the important question is:
Why does the linux spidev use the wrong spi speed and was called repeatedly? 
In my test prog when we called ioctl(*spi_cs_fd, SPI_IOC_WR_MAX_SPEED_HZ, 
&spi_speed)
the linux driver was called repeatedly too. 

So i will ask my question in the linux_spi mailing list.

Thanks for your help.
Greeting from Lüneburg
Alexander

-----Ursprüngliche Nachricht-----
Von: Stefan Tauner [mailto:[email protected]] 
Gesendet: Mittwoch, 23. August 2017 00:56
An: Hänel-Baas, Alexander
Cc: [email protected]
Betreff: Re: [flashrom] linux_spi:speed does not work?

On Tue, 22 Aug 2017 13:10:07 +0000
"Hänel-Baas, Alexander" <[email protected]> wrote:

> Hi,
> 
> we use flashrom 0.99 to program the Spansion flash chip "S25FL064A/P" with 
> the spi interface from the QoriQ LS1021a.
> The linux version is: 4.4.26.
> 
> In the dts the spi speed is set to 16MHz, flashrom is lucky and programs the 
> flash chip fine.
> To increase the programming time, we set the spi speed up to 50MHz in the 
> dts, but now flashrom can't find the spansion chip.
> 
> My dts:
> &dspi0 {
>       bus-num = <0>;
>       status = "okay";
> 
>         spidev0: spidev@0 {
>               compatible = "rohm,dh2228fv";
>               reg = <0>;
>                               spi-max-frequency = <50000000>; //16MHz works
>       };
> 
> In this case I pass the spi speed with the parameter: 
> linux_spi:spispeed=16000  but this parameter doesn't help.
> 
> My flashrom call:
> flashrom -p linux_spi:spispeed=16000,dev=/dev/spidev0.0 -n -w 
> /opt/SIEBMEYER/fpga/readout_SPI_FEED_F00D.bin -c S25FL064A/P
> 
> The flashrom output:
> flashrom v0.9.9-r1955 on Linux 4.4.26-TQMLS102xA-BSP-0100-Alex 
> (armv7l) flashrom is free software, get the source code at 
> https://flashrom.org
> 
> flashrom was built with libpci 3.2.1, GCC 5.4.0, little endian Command 
> line (8 args): flashrom -p linux_spi:spispeed=16000,dev=/dev/spidev0.0 
> -n -w /opt/SIEBMEYER/fpga/readout_SPI_FEED_F00D.bin -c S25FL064A/P -V 
> Calibrating delay loop... OS timer resolution is 2 usecs, 467M loops per 
> second, 10 myus = 10 us, 100 myus = 94 us, 1000 myus = 949 us, 10000 myus = 
> 9433 us, 8 myus = 8 us, OK.
> Initializing linux_spi programmer
> Using device /dev/spidev0.0
> Using 16000 kHz clock
> The following protocols are supported: SPI.
> Probing for Spansion S25FL064A/P, 8192 kB: RDID byte 0 parity 
> violation. probe_spi_rdid_generic: id1 0x00, id2 0x10b No EEPROM/flash device 
> found.
> 
> And here the important kernel message: (spi support is compile with debug)
> [   87.194660] spidev spi0.0: setup mode 0, 8 bits/w, 16000000 Hz max  --> 0  
> <-- this is my speed given by linux_spi:spispeed
> [   87.194706] spidev spi0.0: setup mode 0, 8 bits/w, 50000000 Hz max  --> 0  
> <--  this is the default speed given by dts
> [   87.194841] spidev spi0.0: setup mode 0, 8 bits/w, 50000000 Hz max  --> 0
> 
> What can I do, to set the spi speed from userland correctly?
> Can one flashrom call produce different spi_setup() outputs?
> 
> I hope we can clarify this.

Hi Alexander,

we are using the standard Linux SPI interface and set the SPI clock via the 
SPI_IOC_WR_MAX_SPEED_HZ ioctl (cf. linux_spi.c). The last time I checked there 
was no possibility to read back the currently set frequency, so the only thing 
we can do within flashrom is check if the ioctl succeeded and it apparently 
does. My experience with these drivers is limited, but my best guess is that 
there is a bug in the implementation of the LS1021a-specific SPI driver. And 
that it actually uses 50 MHz which is too much for the connection (and chip) in 
question.

--
Kind regards/Mit freundlichen Grüßen, Stefan Tauner
_______________________________________________
flashrom mailing list
[email protected]
https://mail.coreboot.org/mailman/listinfo/flashrom

Reply via email to