spi25: Implement multi-i/o reads

We describe a read operation in a new  `struct spi_read_op`. It's
comprised of the i/o mode, its opcode, an optional mode byte, and
the number of dummy bytes.

Based on this information  about the various read operations, and
the flash and master feature flags,  we select the read operation
with the highest throughput.

The following assumption is made about 4BA chips: When it supports
native-4BA fast reads  and a multi-i/o version of the regular fast
read, then it should also support the respective native-4BA, multi-
i/o version (yes, JEDEC, there are too many read commands!). So far
this seems to hold for the chips in our database.

Change-Id: I3c93e71d85f769831d637c14d3571f7ddb54d8b2
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/49
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/include/flash.h b/include/flash.h
index da73df5..f839995 100644
--- a/include/flash.h
+++ b/include/flash.h
@@ -428,6 +428,8 @@
 	void *user_data;
 };
 
+struct spi_read_op;
+
 struct flashprog_flashctx {
 	struct flashchip *chip;
 	/* FIXME: The memory mappings should be saved in a more structured way. */
@@ -458,6 +460,8 @@
            of the extended address register. */
 	int address_high_byte;
 	bool in_4ba_mode;
+	/* For SPI flash chips, we dynamically select the fast-read operation. */
+	const struct spi_read_op *spi_fast_read;
 
 	int chip_restore_fn_count;
 	struct chip_restore_func_data {