Hi
I'm just starting to look at fashrom to see how to read/update SPI flash on
a PCIe card
lspci -d 1106:3483
01:00.0 USB controller: VIA Technologies, Inc. VL805 USB 3.0 Host
Controller (rev 01)
There isn't much from Via but the chipset is used in the Raspberry Pi 4 and
the Pi firmware provides a flash tool vl805 (no source code of course!)
I can run it on Intel with Qemu - unfortunately for me the tool is hard
coded for a different SPI flash chip (and in later Pi hardware seems to
have been moved/removed)
Inspecting the board and related datasheets (VL800) the chipset has an SPI
interface for firmware, and it can be used for PCI BIOS apparently. The
actual SPI chip varies from board to board - mine is FM25Q04 from the data
sheet ID=A112. Raspberry Pi seems to use W25X10BV based on the ID EF10
Are there any simple examples of accessing SPI on PCIe cards?
sorry for the long post - I've included a bit more info on what I could
find on the chip
thanks
John Paul
Other info on the chip:
I can read the firmware version easily:
sudo lspci -d 1106:3483 -xxx | awk '/^50:/ { print "VL805 FW version: " $5
$4 $3 $2 }'
I can use strace to see what vl805 doing - I can make out some SPI commands
- here it reads the SPI flash chip ID:
openat(AT_FDCWD, "/sys/bus/pci/devices/0000:01:00.0/config", O_RDWR) = 4
(bunch of reads/writes)
pread64(4, "\22\241\22\241", 4, 124) = 4
write(1, "R Rx_REG0 a112a112\n", 19) = 19
sudo ~/vl805/vl805 -d
VL805 FW version: 00013600
W CHIP_SEL 00000001
R PCI_WB_EN ffffffff
W PCI_WB_EN ffffff01
R STOP_POLLING 00000001
W STOP_POLLING 00000001
W CTRL_REG 000005a0
W CLK_DIV 0000000a
W CHIP_SEL 00000000
W Tx_REG0 90000000
W CTRL_REG 000005c0
R Rx_REG0 a112a112
W CHIP_SEL 00000001
* flash ID mismatch - found a112, expected 0000ef10
I was able to find a Windows based firmware updater which supports about 20
different SPI chips - people have reported adding new chipsets, looks like
I have to add mine as well.
The flash tool runs under wine but it can't read anything - will have to
find a fix or run in a vm.
Via SpiFlash.ini:
[MX25L512]
FlashID=C22010
ReadID=9F
WriteEnable=06
WriteStatus=01
ChipErase=60
ReadData=03
ReadStatus=05
PageProgram=02
ClockRate=32
PageSize=100
Raspberry Pi 4 ?
[W25X10BV]
FlashID=EF10
ReadID=90000000
WriteEnable=06
WriteStatus=01
ChipErase=C7
ReadData=03
ReadStatus=05
PageProgram=02
ClockRate=32
PageSize=10