spi25: Integrate 4BA support
Allow 4-byte addresses for instructions usually used with 3-byte
addresses. Decide in which way the 4th byte will be communicated
based on the state of the chip (i.e. have we enabled 4BA mode)
and a new feature bit for an extended address register. If we
are not in 4BA mode and no extended address register is available
or the write to it fails, bail out.
We cache the state of 4BA mode and the extended address register
in the flashctx.
Change-Id: I644600beaab9a571b97b67f7516abe571d3460c1
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/22384
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/flashrom.c b/flashrom.c
index 12d7390..8849f63 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -2215,6 +2215,9 @@
if (flash->chip->unlock)
flash->chip->unlock(flash);
+ flash->address_high_byte = -1;
+ flash->in_4ba_mode = false;
+
/* Enable/disable 4-byte addressing mode if flash chip supports it */
if ((flash->chip->feature_bits & FEATURE_4BA_SUPPORT) &&
flash->chip->four_bytes_addr_funcs.set_4ba) {