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/bitbang_spi.c b/bitbang_spi.c
index 33ea050..eb6988f 100644
--- a/bitbang_spi.c
+++ b/bitbang_spi.c
@@ -89,11 +89,11 @@
 	}
 }
 
-static int bitbang_spi_send_command(const struct flashctx *flash,
+static int bitbang_spi_send_command(const struct spi_master *,
 				    unsigned int writecnt, unsigned int readcnt,
 				    const unsigned char *writearr,
 				    unsigned char *readarr);
-static int bitbang_spi_send_multicommand(const struct flashctx *, struct spi_command *);
+static int bitbang_spi_send_multicommand(const struct spi_master *, struct spi_command *);
 static int bitbang_spi_shutdown(void *data);
 
 static const struct spi_master spi_master_bitbang = {
@@ -245,13 +245,13 @@
 	}
 }
 
-static int bitbang_spi_send_command(const struct flashctx *flash,
+static int bitbang_spi_send_command(const struct spi_master *mst,
 				    unsigned int writecnt, unsigned int readcnt,
 				    const unsigned char *writearr,
 				    unsigned char *readarr)
 {
 	unsigned int i;
-	const struct bitbang_spi_master_data *data = flash->mst.spi->data;
+	const struct bitbang_spi_master_data *data = mst->data;
 	const struct bitbang_spi_master *master = data->mst;
 
 	/* FIXME: Run bitbang_spi_request_bus here or in programmer init?
@@ -275,9 +275,9 @@
 	return 0;
 }
 
-static int bitbang_spi_send_multicommand(const struct flashctx *flash, struct spi_command *cmds)
+static int bitbang_spi_send_multicommand(const struct spi_master *mst, struct spi_command *cmds)
 {
-	const struct bitbang_spi_master_data *const bbs = flash->mst.spi->data;
+	const struct bitbang_spi_master_data *const bbs = mst->data;
 	int ret = 0;
 
 	bitbang_spi_request_bus(bbs->mst, bbs->spi_data);