probing: Pass full struct flashchip into probes
In case we want to probe for a particular chip, we can filter the
actual probing sequences by its properties.
We'll use `struct flashchip` internally and `struct flashprog_chip`
will be used only close to the libflashprog API. This way, we can
separate the two later again if necessary.
Change-Id: Id8b13d28fcaefee62746c9391fe86b4b3b09a428
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/441
diff --git a/spi25.c b/spi25.c
index f45f9a2..a628770 100644
--- a/spi25.c
+++ b/spi25.c
@@ -96,7 +96,9 @@
return spi_send_command(flash, sizeof(cmd), 0, cmd, NULL);
}
-struct found_id *probe_spi_rdid(const struct bus_probe *probe, const struct master_common *mst)
+struct found_id *probe_spi_rdid(const struct bus_probe *probe,
+ const struct master_common *mst,
+ const struct flashchip *chip)
{
const struct spi_master *const spi = (const struct spi_master *)mst;
unsigned char readarr[4];
@@ -147,7 +149,9 @@
return found;
}
-struct found_id *probe_spi_rems(const struct bus_probe *probe, const struct master_common *mst)
+struct found_id *probe_spi_rems(const struct bus_probe *probe,
+ const struct master_common *mst,
+ const struct flashchip *chip)
{
const struct spi_master *const spi = (const struct spi_master *)mst;
unsigned char readarr[JEDEC_REMS_INSIZE];
@@ -173,7 +177,9 @@
return found;
}
-struct found_id *probe_spi_res(const struct bus_probe *probe, const struct master_common *mst)
+struct found_id *probe_spi_res(const struct bus_probe *probe,
+ const struct master_common *mst,
+ const struct flashchip *chip)
{
const struct spi_master *const spi = (const struct spi_master *)mst;
const unsigned int res_len = probe->type == ID_SPI_RES3 ? 3 :
@@ -229,7 +235,9 @@
}
/* Only used for some Atmel chips. */
-struct found_id *probe_spi_at25f(const struct bus_probe *probe, const struct master_common *mst)
+struct found_id *probe_spi_at25f(const struct bus_probe *probe,
+ const struct master_common *mst,
+ const struct flashchip *chip)
{
static const unsigned char cmd[AT25F_RDID_OUTSIZE] = { AT25F_RDID };
const struct spi_master *const spi = (const struct spi_master *)mst;