spi: Prepare for multi i/o and dummy bytes

Multi-i/o commands split SPI transactions into multiple phases that
can be transferred over 1, 2 or 4 wires. For this, we adapt `struct
spi_command` with a new enum, specifying the transfer mode, and ad-
ditional size fields.  While we are at it, move everything related
into a new header file `spi_command.h` so we won't further clutter
`flash.h`.

On the master side, we add respective feature flags for the multi-
i/o modes.

See also the comment in `spi_command.h` about multi-i/o commands.

Change-Id: I79debb845f1c8fec77e0556853ffb01735e73ab8
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/44
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/spi25_statusreg.c b/spi25_statusreg.c
index 508ee5d..b363b5f 100644
--- a/spi25_statusreg.c
+++ b/spi25_statusreg.c
@@ -19,6 +19,7 @@
 
 #include "flash.h"
 #include "chipdrivers.h"
+#include "spi_command.h"
 #include "spi.h"
 
 /* === Generic functions === */
@@ -138,21 +139,15 @@
 
 	struct spi_command cmds[] = {
 	{
-		.writecnt	= JEDEC_WREN_OUTSIZE,
+		.opcode_len	= JEDEC_WREN_OUTSIZE,
 		.writearr	= &enable_cmd,
-		.readcnt	= 0,
-		.readarr	= NULL,
 	}, {
-		.writecnt	= write_cmd_len,
+		.opcode_len	= 1,
+		.write_len	= write_cmd_len - 1,
 		.writearr	= write_cmd,
-		.readcnt	= 0,
-		.readarr	= NULL,
-	}, {
-		.writecnt	= 0,
-		.writearr	= NULL,
-		.readcnt	= 0,
-		.readarr	= NULL,
-	}};
+	},
+		NULL_SPI_CMD
+	};
 
 	int result = spi_send_multicommand(flash, cmds);
 	if (result) {