Edward O'Callaghan has uploaded this change for review.

View Change

flashrom.c: Validate BUS before trying 4BA commands

4BA is sort of broken for opaque masters.

Instead of just leaning on the chip feature flag to determine when to
enter_exit out of 4ba modes, validate '(flash->chip->bustype == BUS_SPI)'.
The following chips;
- GD25Q256D
- MX25L25635F/MX25L25645G
- W25Q256.V
- W25Q256JV_M
Have issue with opaque masters that tries incorrectly
to issue 4BA commands which results in failure.

Change-Id: Ie26732b03a67bfafc8eae1f642dc85c6d37f7772
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
---
M flashrom.c
1 file changed, 2 insertions(+), 1 deletion(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/71/64371/1
diff --git a/flashrom.c b/flashrom.c
index 7f54488..356de79 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1845,7 +1845,8 @@
}

/* Enable/disable 4-byte addressing mode if flash chip supports it */
- if (flash->chip->feature_bits & (FEATURE_4BA_ENTER | FEATURE_4BA_ENTER_WREN | FEATURE_4BA_ENTER_EAR7)) {
+ if ((flash->chip->bustype == BUS_SPI) &&
+ (flash->chip->feature_bits & (FEATURE_4BA_ENTER | FEATURE_4BA_ENTER_WREN | FEATURE_4BA_ENTER_EAR7))) {
int ret;
if (spi_master_4ba(flash))
ret = spi_enter_4ba(flash);

To view, visit change 64371. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ie26732b03a67bfafc8eae1f642dc85c6d37f7772
Gerrit-Change-Number: 64371
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-MessageType: newchange