diff --git a/flashrom.c b/flashrom.c index 573f10b39..785da6f3c 100644 --- a/flashrom.c +++ b/flashrom.c @@ -446,6 +446,18 @@ static int check_block_eraser(const struct flashctx *flash, int k, int log) "eraseblock layout is not defined. "); return 1; } + + if (flash->mst->buses_supported & BUS_SPI) { + const uint8_t *opcode = spi_get_opcode_from_erasefn(eraser.block_erase); + for (int i = 0; opcode[i]; i++) { + if (!flash->mst->spi.probe_opcode(flash, opcode[i])) { + if (log) + msg_cdbg("block erase function and layout found " + "but SPI master doesn't support the function. "); + return 1; + } + } + } // TODO: Once erase functions are annotated with allowed buses, check that as well. return 0; }