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/amd_spi100.c b/amd_spi100.c
index c37ed07..e011ed5 100644
--- a/amd_spi100.c
+++ b/amd_spi100.c
@@ -101,11 +101,11 @@
return 0;
}
-static int spi100_send_command(const struct flashctx *const flash,
+static int spi100_send_command(const struct spi_master *const mst,
const unsigned int writecnt, const unsigned int readcnt,
const unsigned char *const writearr, unsigned char *const readarr)
{
- const struct spi100 *const spi100 = flash->mst.spi->data;
+ const struct spi100 *const spi100 = mst->data;
int ret = spi100_check_readwritecnt(writecnt, readcnt);
if (ret)