
On Tue, Jul 12, 2022 at 2:41 PM Xavier Drudis Ferran xdrudis@tinet.cat wrote:
El Wed, Jun 22, 2022 at 10:47:31AM +0200, Xavier Drudis Ferran deia:
The Radxa Rock Pi 4 board is sold from revision 1.4 with a soldered 4Mb SPI NOR Flash. This series allows to use it from U-Boot and boot from it.
Hello. Is there any interest in this ?
This weekend I did a v2 on next. But I don't know whether I should send it or just save you all the trouble.
I can boot from SPI (I mean, bootrom loads TPL from SPI, TPL return to bootrom, bootrom loads SPL from SPI, SPL loading U-Boot from SPI, then U-Boot loads linux and dtb from SDMMC) and can stop U-Boot and read, erase and write from SPI, But once I boot linux,
flashrom -V --programmer linux_mtd --write /boot/spi.rom [...] get_mtd_info: device_name: "loader", is_writeable: 1, numeraseregions: 0, total_size: 4194304, erasesize: 4096 Opened /dev/mtd0 successfully The following protocols are supported: Programmer-specific. Probing for Programmer Opaque flash chip, 0 kB: Found Programmer flash chip "Opaque flash chip" (4096 kB, Programmer-specific) on linux_mtd. Found Programmer flash chip "Opaque flash chip" (4096 kB, Programmer-specific). Reading old flash chip contents... done. Erasing and writing flash chip... Trying erase function 0... 0x000000-0x000fff:WCannot write 0x001000 bytes at 0x000000 [...]
If I boot from SDMMC (shorting spiclk to ground) then linux doesn't have a /dev/mtd0 device. But that's easy to fix. If I boot from SDMMC, stop U-boot, disconnect spiclk from gnd, sf probe 1:0 and continue boot then I can write /dev/mtd0 from flashrom in linux without a problem. I can also read, erase and write SPI from U-Boot.
So there's something when booting from SPI that stops linux from writing to it, despite U-Boot can. I tested also sf protect unlock 0 0x400000 but it doesn't help.
So should I send v2 ? wait until I understand what happens when booting from SPI but not writing to /dev/mtd0 ? Forget it ?
We have SPI flash boot tested on existing boards, so please send the associate patches if you want to support for rock-pi-4.
Thanks, Jagan.