diff options
author | Nico Huber <nico.h@gmx.de> | 2018-12-22 16:54:59 +0100 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2019-04-02 16:55:43 +0000 |
commit | dc5af547df8b2f852deb5ddad86bb90ff0fc50c0 (patch) | |
tree | 3b23dcce1e43e520ca0a6db314d6920a89b1f72a | |
parent | 3d7b1e3b5c04304d3680bd950e7672f6336b01d6 (diff) | |
download | flashrom-dc5af547df8b2f852deb5ddad86bb90ff0fc50c0.tar.gz flashrom-dc5af547df8b2f852deb5ddad86bb90ff0fc50c0.tar.bz2 flashrom-dc5af547df8b2f852deb5ddad86bb90ff0fc50c0.zip |
dediprog: Disable 4BA completelyv1.1-rc1
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 <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/30386
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
-rw-r--r-- | dediprog.c | 1 | ||||
-rw-r--r-- | flashrom.c | 10 | ||||
-rw-r--r-- | programmer.h | 7 |
3 files changed, 18 insertions, 0 deletions
diff --git a/dediprog.c b/dediprog.c index 44a0018d8..c99c92256 100644 --- a/dediprog.c +++ b/dediprog.c @@ -933,6 +933,7 @@ static int parse_voltage(char *voltage) static const struct spi_master spi_master_dediprog = { .type = SPI_CONTROLLER_DEDIPROG, + .features = SPI_MASTER_NO_4BA_MODES, .max_data_read = 16, /* 18 seems to work fine as well, but 19 times out sometimes with FW 5.15. */ .max_data_write = 16, .command = dediprog_spi_send_command, diff --git a/flashrom.c b/flashrom.c index 135cc3e00..d6c4d248d 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; diff --git a/programmer.h b/programmer.h index 8bf7d2947..d22bc6b73 100644 --- a/programmer.h +++ b/programmer.h @@ -659,6 +659,8 @@ enum spi_controller { #define MAX_DATA_WRITE_UNLIMITED 256 #define SPI_MASTER_4BA (1U << 0) /**< Can handle 4-byte addresses */ +#define SPI_MASTER_NO_4BA_MODES (1U << 1) /**< Compatibility modes (i.e. extended address + register, 4BA mode switch) don't work */ struct spi_master { enum spi_controller type; @@ -851,6 +853,11 @@ static inline bool spi_master_4ba(const struct flashctx *const flash) return flash->mst->buses_supported & BUS_SPI && flash->mst->spi.features & SPI_MASTER_4BA; } +static inline bool spi_master_no_4ba_modes(const struct flashctx *const flash) +{ + return flash->mst->buses_supported & BUS_SPI && + flash->mst->spi.features & SPI_MASTER_NO_4BA_MODES; +} /* usbdev.c */ struct libusb_device_handle; |