[flashrom] Raspberry Pi spidev failure

Sean Cross sean at xobs.io
Thu Nov 22 10:46:20 CET 2018



------ Original Message ------
From: "Nico Huber" <nico.h at gmx.de>
To: "Sean Cross" <sean at xobs.io>; flashrom at flashrom.org
Sent: 22/11/2018 5:28:37 PM
Subject: Re: [flashrom] Raspberry Pi spidev failure

>Hi Sean,
>
>>1) I'm completely unable to access any SPI chips.  This appears to be
>>due to a bug in the kernel driver, which always yanks the CS line high
>>despite the cs_change set to 0.  A workaround I've come up with is to 
>>do
>>everything as a single transaction, which seems to fix the problem on 
>>my
>>device:
>
>what you describe should be impossible, theoretically. CS high means do
>nothing. If it stays that way it wouldn't matter if you do everything 
>in
>a single long "do nothing" or in separate shorter ones.
>
>So... how do you sample the CS line?
>
>And at which speed do you run the SPI bus? i.e. the `spispeed` 
>parameter
>to flashrom's linux_spi driver. If you didn't set any, it might just be
>too fast.
I've attached a png where I measure both the clock and the CS line.  
This is the result of running the command:

  ./flashrom -c W25Q128.V..M --programmer 
linux_spi:dev=/dev/spidev0.0,spispeed=1000

You can see the first 8-bit command gets sent, followed by CS getting 
driven high, and then low again when it clocks in the 24-bit response.  
Because CS went high, the response came back as all 1s.

With the patch I sent CS does not go high, and so flashrom is able to 
work.

>
>>2) The other issue is that my device appears to want SPI_MODE_1.  When 
>>I
>>set SPI_MODE_1, it is able to detect and program the board, but fails 
>>to
>>verify.  The image that gets loaded still works, but I'm unsure of
>>what's causing the issue.
>
>What device is it?
This is a W25Q128JV.  The reference manual reports that it should work 
with SPI_MODE_0 or SPI_MODE_3, so it's odd that it works only in MODE_1. 
  I suspect there is something seriously wrong with the Raspberry Pi 
kernel here.


Sean
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 181122_050734.png
Type: image/png
Size: 13292 bytes
Desc: not available
URL: <http://mail.coreboot.org/pipermail/flashrom/attachments/20181122/dc24e9c7/attachment-0001.png>


More information about the flashrom mailing list