spi: Use bus probing for RDID

We put 3 and 4 byte RDID into a single function. Only if we can't
read 4 bytes, we try again with 3. There are no conflicts because
the only RDID4 manufacturer ID contains the 0x7f prefix, hence it
can't match any 3-byte ID.

Change-Id: I5d35bc30255aae66da35d58431628512e50b39f0
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/74900
diff --git a/include/chipdrivers/probing.h b/include/chipdrivers/probing.h
index fefca3c..8aaf8ed 100644
--- a/include/chipdrivers/probing.h
+++ b/include/chipdrivers/probing.h
@@ -32,7 +32,6 @@
 	ID_OPAQUE,
 	ID_SPI_AT25F,
 	ID_SPI_RDID,
-	ID_SPI_RDID4,
 	ID_SPI_REMS,
 	ID_SPI_RES1,
 	ID_SPI_RES2,
diff --git a/include/chipdrivers/spi.h b/include/chipdrivers/spi.h
index 186575c..9b14342 100644
--- a/include/chipdrivers/spi.h
+++ b/include/chipdrivers/spi.h
@@ -19,6 +19,8 @@
 #include <stdint.h>
 
 struct flashprog_flashctx;
+struct master_common;
+struct bus_probe;
 
 /* spi.c */
 int spi_aai_write(struct flashprog_flashctx *, const uint8_t *buf, unsigned int start, unsigned int len);
@@ -26,9 +28,9 @@
 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 *);
+
 int spi_simple_write_cmd(struct flashprog_flashctx *, uint8_t op, unsigned int poll_delay);
-int probe_spi_rdid(struct flashprog_flashctx *);
-int probe_spi_rdid4(struct flashprog_flashctx *);
 int probe_spi_rems(struct flashprog_flashctx *);
 int probe_spi_res1(struct flashprog_flashctx *);
 int probe_spi_res2(struct flashprog_flashctx *);