From dc5af547df8b2f852deb5ddad86bb90ff0fc50c0 Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Sat, 22 Dec 2018 16:54:59 +0100 Subject: dediprog: Disable 4BA completely This is an interim solution. We'll have to enable 4BA step-by-step for each dediprog protocol version. Change-Id: I08efcbb09ab3499ef6902a698e9ce3d6232237c4 Signed-off-by: Nico Huber Reviewed-on: https://review.coreboot.org/c/flashrom/+/30386 Tested-by: build bot (Jenkins) Reviewed-by: David Hendricks --- flashrom.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'flashrom.c') diff --git a/flashrom.c b/flashrom.c index 135cc3e0..d6c4d248 100644 --- a/flashrom.c +++ b/flashrom.c @@ -2333,6 +2333,16 @@ int prepare_flash_access(struct flashctx *const flash, flash->address_high_byte = -1; flash->in_4ba_mode = false; + /* Be careful about 4BA chips and broken masters */ + if (flash->chip->total_size > 16 * 1024 && spi_master_no_4ba_modes(flash)) { + /* If we can't use native instructions, bail out */ + if ((flash->chip->feature_bits & FEATURE_4BA_NATIVE) != FEATURE_4BA_NATIVE + || !spi_master_4ba(flash)) { + msg_cerr("Programmer doesn't support this chip. Aborting.\n"); + return 1; + } + } + /* 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)) { int ret; -- cgit v1.2.3