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/include/chipdrivers/spi.h b/include/chipdrivers/spi.h
index 547885c..94a6a1f 100644
--- a/include/chipdrivers/spi.h
+++ b/include/chipdrivers/spi.h
@@ -21,6 +21,7 @@
struct flashprog_flashctx;
struct master_common;
struct bus_probe;
+struct flashchip;
/* spi.c */
int spi_aai_write(struct flashprog_flashctx *, const uint8_t *buf, unsigned int start, unsigned int len);
@@ -28,10 +29,10 @@
int spi_chip_read(struct flashprog_flashctx *, uint8_t *buf, unsigned int start, int unsigned len);
/* spi25.c */
-struct found_id *probe_spi_rdid(const struct bus_probe *, const struct master_common *);
-struct found_id *probe_spi_rems(const struct bus_probe *, const struct master_common *);
-struct found_id *probe_spi_res(const struct bus_probe *, const struct master_common *);
-struct found_id *probe_spi_at25f(const struct bus_probe *, const struct master_common *);
+struct found_id *probe_spi_rdid(const struct bus_probe *, const struct master_common *, const struct flashchip *);
+struct found_id *probe_spi_rems(const struct bus_probe *, const struct master_common *, const struct flashchip *);
+struct found_id *probe_spi_res(const struct bus_probe *, const struct master_common *, const struct flashchip *);
+struct found_id *probe_spi_at25f(const struct bus_probe *, const struct master_common *, const struct flashchip *);
int spi_simple_write_cmd(struct flashprog_flashctx *, uint8_t op, unsigned int poll_delay);
int spi_write_enable(struct flashprog_flashctx *);
@@ -119,7 +120,7 @@
int spi_erase_at45cs_sector(struct flashprog_flashctx *, unsigned int addr, unsigned int blocklen);
/* spi95.c */
-struct found_id *probe_spi_st95(const struct bus_probe *, const struct master_common *);
+struct found_id *probe_spi_st95(const struct bus_probe *, const struct master_common *, const struct flashchip *);
int spi_block_erase_emulation(struct flashprog_flashctx *, unsigned int addr, unsigned int blocklen);
/* writeprotect_ranges.c */
@@ -130,7 +131,7 @@
void decode_range_spi25_2x_block(size_t *start, size_t *len, const struct wp_bits *, size_t chip_len);
/* sfdp.c */
-struct found_id *probe_spi_sfdp(const struct bus_probe *, const struct master_common *);
+struct found_id *probe_spi_sfdp(const struct bus_probe *, const struct master_common *, const struct flashchip *);
int spi_prepare_sfdp(struct flashprog_flashctx *, enum preparation_steps);
#endif /* !__CHIPDRIVERS_SPI_H__ */