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/dediprog.c b/dediprog.c
index af9e449..c114f7b 100644
--- a/dediprog.c
+++ b/dediprog.c
@@ -841,21 +841,21 @@
 	return dediprog_spi_write_chunked(flash, buf, start, len, WRITE_MODE_2B_AAI);
 }
 
-static int dediprog_spi_send_command(const struct flashctx *flash,
+static int dediprog_spi_send_command(const struct spi_master *mst,
 				     unsigned int writecnt,
 				     unsigned int readcnt,
 				     const unsigned char *writearr,
 				     unsigned char *readarr)
 {
-	struct dediprog_data *const dp_data = flash->mst.spi->data;
+	struct dediprog_data *dp_data = mst->data;
 	int ret;
 
 	msg_pspew("%s, writecnt=%i, readcnt=%i\n", __func__, writecnt, readcnt);
-	if (writecnt > flash->mst.spi->max_data_write + 5) {
+	if (writecnt > mst->max_data_write + 5) {
 		msg_perr("Invalid writecnt=%i, aborting.\n", writecnt);
 		return 1;
 	}
-	if (readcnt > flash->mst.spi->max_data_read) {
+	if (readcnt > mst->max_data_read) {
 		msg_perr("Invalid readcnt=%i, aborting.\n", readcnt);
 		return 1;
 	}