spi25: Introduce generic spi_prepare_io()/spi_finish_io()

Introduce two new functions to be hooked up in the chip database:
* spi_prepare_io(), and
* spi_finish_io().

These will be used to prepare multi-i/o and QPI operations. Hence,
hook them up to all the chips that support those. spi_prepare_4ba()
is wrapped to account for overlaps with 4BA support.

Change-Id: I444f6322b6d6a26a040cb0ca972b2c411838d702
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/163
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/include/chipdrivers.h b/include/chipdrivers.h
index 272b65c..94db44b 100644
--- a/include/chipdrivers.h
+++ b/include/chipdrivers.h
@@ -61,7 +61,8 @@
 int spi_set_extended_address(struct flashctx *, uint8_t addr_high);
 
 /* spi25_prepare.c */
-int spi_prepare_4ba(struct flashctx *, enum preparation_steps);
+int spi_prepare_io(struct flashctx *, enum preparation_steps);
+void spi_finish_io(struct flashctx *);
 
 
 /* spi25_statusreg.c */
diff --git a/include/flash.h b/include/flash.h
index 0b34184..da73df5 100644
--- a/include/flash.h
+++ b/include/flash.h
@@ -171,6 +171,11 @@
 #define FEATURE_QPI_38		(FEATURE_QIO | FEATURE_QPI_38_FF)
 #define FEATURE_QPI_SRP		(FEATURE_QPI_38 | FEATURE_SET_READ_PARAMS)
 
+/* Catch all dual/quad features to be able to mask them */
+#define FEATURE_ANY_DUAL	(FEATURE_FAST_READ_DOUT | FEATURE_FAST_READ_DIO)
+#define FEATURE_ANY_QUAD	(FEATURE_QPI_35_F5 | FEATURE_QPI_38_FF | \
+				 FEATURE_FAST_READ_QOUT | FEATURE_FAST_READ_QIO | FEATURE_FAST_READ_QPI4B)
+
 #define ERASED_VALUE(flash)	(((flash)->chip->feature_bits & FEATURE_ERASED_ZERO) ? 0x00 : 0xff)
 
 enum test_state {