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/flashprog.c b/flashprog.c
index 704fd2e..ec19f46 100644
--- a/flashprog.c
+++ b/flashprog.c
@@ -1539,6 +1539,16 @@
 					 "Please report a bug at flashprog@flashprog.org\n", i,
 					 chip->name == NULL ? "unnamed" : chip->name);
 			}
+			if (chip->feature_bits &
+			    (FEATURE_4BA_ENTER | FEATURE_4BA_ENTER_WREN | FEATURE_4BA_ENTER_EAR7 |
+			     FEATURE_ANY_DUAL | FEATURE_ANY_QUAD)
+			    && !chip->prepare_access) {
+				msg_gerr("ERROR: Flash chip #%d (%s) misses chip\n"
+					 "preparation function for 4BA and multi-i/o modes.\n"
+					 "Please report a bug at flashprog@flashprog.org\n", i,
+					 chip->name == NULL ? "unnamed" : chip->name);
+				ret = 1;
+			}
 			if (selfcheck_eraseblocks(chip)) {
 				ret = 1;
 			}