spi: Pass master instead of flash to .send_command
In the SPI-master API, `.send_command` should only forward commands to
the SPI bus. All details about the commands and the SPI slave should be
handled in the chip driver. Hence, replace the `flashctx` pointer with
one to the `spi_master` to enforce proper separation.
Change-Id: I50934a1294217794b7e23cc98ade7e4279c059a1
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/74897
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/dummyflasher.c b/dummyflasher.c
index 948dc0b..a1e15b0 100644
--- a/dummyflasher.c
+++ b/dummyflasher.c
@@ -100,7 +100,7 @@
-static int dummy_spi_send_command(const struct flashctx *flash, unsigned int writecnt, unsigned int readcnt,
+static int dummy_spi_send_command(const struct spi_master *, unsigned int writecnt, unsigned int readcnt,
const unsigned char *writearr, unsigned char *readarr);
static int dummy_spi_write_256(struct flashctx *flash, const uint8_t *buf,
unsigned int start, unsigned int len);
@@ -1143,13 +1143,12 @@
return 0;
}
-static int dummy_spi_send_command(const struct flashctx *flash, unsigned int writecnt,
- unsigned int readcnt,
- const unsigned char *writearr,
- unsigned char *readarr)
+static int dummy_spi_send_command(const struct spi_master *mst,
+ unsigned int writecnt, unsigned int readcnt,
+ const unsigned char *writearr, unsigned char *readarr)
{
unsigned int i;
- struct emu_data *emu_data = flash->mst.spi->data;
+ struct emu_data *emu_data = mst->data;
if (!emu_data) {
msg_perr("No data in flash context!\n");
return 1;