diff options
-rw-r--r-- | flashrom.c | 2 | ||||
-rw-r--r-- | include/programmer.h | 6 |
2 files changed, 7 insertions, 1 deletions
@@ -1944,7 +1944,7 @@ int prepare_flash_access(struct flashctx *const flash, } /* 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 (spi_chip_4ba(flash)) { int ret; if (spi_master_4ba(flash)) ret = spi_enter_4ba(flash); diff --git a/include/programmer.h b/include/programmer.h index 281a4f69..ad3c5022 100644 --- a/include/programmer.h +++ b/include/programmer.h @@ -513,6 +513,12 @@ 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; } +/* spi_chip feature checks */ +static inline bool spi_chip_4ba(const struct flashctx *const flash) +{ + return flash->chip->bustype == BUS_SPI && + (flash->chip->feature_bits & (FEATURE_4BA_ENTER | FEATURE_4BA_ENTER_WREN | FEATURE_4BA_ENTER_EAR7)); +} /* usbdev.c */ struct libusb_device_handle; |