1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-28 23:43:42 +02:00

Add a SPI command class to struct flashchip

By default, we want to probe for SPI25 chips only. Other SPI use cases,
like the ENE/EDI protocol, might use commands that can confuse these
common chips.

Now, flashrom will probe for a chip only if one of these conditions is
true:
1) no chip has been specified AND the chip uses the SPI25 commands
2) this chip has been specified by -c | --chip <chipname>

The CLI can later be extended to probe for a specific class of chips.

Change-Id: I89a53ccaef2791a2ac32904d7ab813da7478a6f0
Signed-off-by: Mike Banon <mikebdp2@gmail.com>
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/23262
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Kocialkowski <contact@paulk.fr>
This commit is contained in:
Mike Banon 2018-01-15 01:10:00 +03:00 committed by Nico Huber
parent 305a2b3ed3
commit 31b5e3bfe6
2 changed files with 14 additions and 0 deletions

11
flash.h
View File

@ -183,6 +183,17 @@ struct flashchip {
enum test_state write; enum test_state write;
} tested; } tested;
/*
* Group chips that have common command sets. This should ensure that
* no chip gets confused by a probing command for a very different class
* of chips.
*/
enum {
/* SPI25 is very common. Keep it at zero so we don't have
to specify it for each and every chip in the database.*/
SPI25 = 0,
} spi_cmd_set;
int (*probe) (struct flashctx *flash); int (*probe) (struct flashctx *flash);
/* Delay after "enter/exit ID mode" commands in microseconds. /* Delay after "enter/exit ID mode" commands in microseconds.

View File

@ -1209,6 +1209,9 @@ int probe_flash(struct registered_master *mst, int startchip, struct flashctx *f
buses_common = mst->buses_supported & chip->bustype; buses_common = mst->buses_supported & chip->bustype;
if (!buses_common) if (!buses_common)
continue; continue;
/* Only probe for SPI25 chips by default. */
if (chip->bustype == BUS_SPI && !chip_to_probe && chip->spi_cmd_set != SPI25)
continue;
msg_gdbg("Probing for %s %s, %d kB: ", chip->vendor, chip->name, chip->total_size); msg_gdbg("Probing for %s %s, %d kB: ", chip->vendor, chip->name, chip->total_size);
if (!chip->probe && !force) { if (!chip->probe && !force) {
msg_gdbg("failed! flashrom has no probe function for this flash chip.\n"); msg_gdbg("failed! flashrom has no probe function for this flash chip.\n");