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/spi25.c b/spi25.c
index 34f30df..0f49a13 100644
--- a/spi25.c
+++ b/spi25.c
@@ -312,10 +312,12 @@
{
struct spi_command cmds[] = {
{
+ .io_mode = spi_current_io_mode(flash),
.readarr = 0,
.opcode_len = 1,
.writearr = (const unsigned char[]){ JEDEC_WREN },
}, {
+ .io_mode = spi_current_io_mode(flash),
.readarr = 0,
.opcode_len = 1,
.writearr = (const unsigned char[]){ op },
@@ -346,10 +348,12 @@
struct spi_command cmds[] = {
{
+ .io_mode = spi_current_io_mode(flash),
.readarr = 0,
.opcode_len = 1,
.writearr = (const unsigned char[]){ JEDEC_WREN },
}, {
+ .io_mode = spi_current_io_mode(flash),
.readarr = 0,
.opcode_len = 1,
.write_len = 1,
@@ -424,10 +428,12 @@
uint8_t cmd[1 + JEDEC_MAX_ADDR_LEN + 256];
struct spi_command cmds[] = {
{
+ .io_mode = spi_current_io_mode(flash),
.readarr = 0,
.opcode_len = 1,
.writearr = (const unsigned char[]){ JEDEC_WREN },
}, {
+ .io_mode = spi_current_io_mode(flash),
.readarr = 0,
.writearr = cmd,
},