Implement QPI support
With the quad-i/o support in place, this is actually straight-
forward:
* we check for compatibility of the flash chip and programmer,
* select an appropriate fast-read function, and
* always set the respective io-mode when passing a SPI command
to the programmer.
Tested with FT4222H + W25Q128FV and linux_gpio_spi + MX25L25645G.
Change-Id: I2287034f6818f24f892d66d1a505cb719838f75d
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/165
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/spi.c b/spi.c
index de7965f..748ef99 100644
--- a/spi.c
+++ b/spi.c
@@ -31,6 +31,9 @@
unsigned int readcnt, const unsigned char *writearr,
unsigned char *readarr)
{
+ if (spi_current_io_mode(flash) != SINGLE_IO_1_1_1)
+ return default_spi_send_command(flash, writecnt, readcnt, writearr, readarr);
+
return flash->mst.spi->command(flash, writecnt, readcnt, writearr,
readarr);
}
@@ -47,7 +50,7 @@
{
struct spi_command cmd[] = {
{
- .io_mode = SINGLE_IO_1_1_1,
+ .io_mode = spi_current_io_mode(flash),
.opcode_len = 1,
.address_len = writecnt - 1,
.read_len = readcnt,