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/jlink_spi.c b/jlink_spi.c
index 7534cbb..5ba40d5 100644
--- a/jlink_spi.c
+++ b/jlink_spi.c
@@ -104,12 +104,13 @@
return true;
}
-static int jlink_spi_send_command(const struct flashctx *flash, unsigned int writecnt, unsigned int readcnt,
+static int jlink_spi_send_command(
+ const struct spi_master *mst, unsigned int writecnt, unsigned int readcnt,
const unsigned char *writearr, unsigned char *readarr)
{
uint32_t length;
uint8_t *buffer;
- struct jlink_spi_data *jlink_data = flash->mst.spi->data;
+ struct jlink_spi_data *jlink_data = mst->data;
length = writecnt + readcnt;