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/spi25_prepare.c b/spi25_prepare.c
index 7fb1a10..76ad9a7 100644
--- a/spi25_prepare.c
+++ b/spi25_prepare.c
@@ -46,11 +46,8 @@
return spi_enter_exit_4ba(flash, false);
}
-int spi_prepare_4ba(struct flashctx *const flash, const enum preparation_steps prep)
+static int spi_prepare_4ba(struct flashctx *const flash)
{
- if (prep != PREPARE_FULL)
- return 0;
-
flash->address_high_byte = -1;
flash->in_4ba_mode = false;
@@ -79,3 +76,19 @@
return 0;
}
+
+int spi_prepare_io(struct flashctx *const flash, const enum preparation_steps prep)
+{
+ if (prep != PREPARE_FULL)
+ return 0;
+
+ int ret = spi_prepare_4ba(flash);
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
+void spi_finish_io(struct flashctx *const flash)
+{
+}