So, I've forgot an SD card of Project Christoph at home and I urgently need to flash a SPI BIOS flash. While I'm installing all my SPI tools on a fresh image, lemme make a log with instructions:
apt-get install subversion usbutils build-essential libftdi1 libftdi-dev zlib1g-dev libusb-dev svn co https://code.coreboot.org/svn/flashrom/trunk flashrom cd flashrom make CONFIG_ENABLE_LIBPCI_PROGRAMMERS=no CONFIG_ENABLE_LIBUSB1_PROGRAMMERS=no Usage instructions: ./flashrom -p linux_spi:dev=/dev/spidev0.0 #Detecting the chip ./flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=8000 -r fw.bin #Reading firmware from it ./flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=8000 -r fw2.bin #Reading firmware again sha512sum fw.bin && sha512sum fw2.bin #Checking two images to see if SPI works OK ./flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=8000 -E #Erasing the chip ./flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=8000 -w image.bin #Writing image to the chip
"spispeed" parameter, although not documented anywhere, means SPI speed in kHz, so 8000 is 8MHz - the fastest Pi can get AFAIK and the parameter that works quite well.
I had plenty of problems today with a SPI flash labeled as W25Q64.W. It was a chip bought in China (like, the buyer was physically in China. Feels weird, right?), and by the datasheet claimed to be working at 1.8V and 1.8V only. It worked for me with all the logic and power shifted to 1.8, however, the readings weren't reliable and the flashing would never verify - the flash would erase correctly and read back as FFs, but writing to it would not get verified. I connected it to 3.3V - and not only it did not burn in flames, it did flash and read correctly. I spent 3 hours on this shit. Conclusion? Don't believe those Chinese-bought flash chips. The markings were looking totally legit, but it feels like a fake to me due to this inconsistency with the datasheet.
This whole code piece sounds like a nice #pyLCI - Linux Control Interface application, but there's still a lot of UI elements I need to add, like file browser and so on.