Let the flash context directly point to the used master

We used to have a pointer to a full `registered_master` struct in
our flash context. Beside the used master, this contained a bit
mask of supported buses. Oddly convenient, this bit mask invited
to bypass the chip driver and break the abstraction. It allowed
to place bus-specific details virtually anywhere in flashprog,
making it harder to find a good place for them.

So, get rid of the `buses_supported` bit mask by pointing directly
to the master. Only the chip driver will implicitly know which type
of master is used.

Change-Id: I9ce13d8df0e7ccc67519d888dd9cb2e2ff8d6682
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/72533
diff --git a/ichspi.c b/ichspi.c
index c7e8fe7..74b4e3e 100644
--- a/ichspi.c
+++ b/ichspi.c
@@ -758,7 +758,7 @@
 
 /* Read len bytes from the fdata/spid register into the data array.
  *
- * Note that using len > flash->mst->spi.max_data_read will return garbage or
+ * Note that using len > flash->mst.spi->max_data_read will return garbage or
  * may even crash.
  */
 static void ich_read_data(uint8_t *data, int len, int reg0_off)
@@ -776,7 +776,7 @@
 
 /* Fill len bytes from the data array into the fdata/spid registers.
  *
- * Note that using len > flash->mst->spi.max_data_write will trash the registers
+ * Note that using len > flash->mst.spi->max_data_write will trash the registers
  * following the data registers.
  */
 static void ich_fill_data(const uint8_t *data, int len, int reg0_off)
@@ -1083,7 +1083,7 @@
 		      uint8_t datalength, uint8_t * data)
 {
 	/* max_data_read == max_data_write for all Intel/VIA SPI masters */
-	uint8_t maxlength = flash->mst->spi.max_data_read;
+	uint8_t maxlength = flash->mst.spi->max_data_read;
 
 	if (ich_generation == CHIPSET_ICH_UNKNOWN) {
 		msg_perr("%s: unsupported chipset\n", __func__);
@@ -1449,7 +1449,7 @@
 
 	while (len > 0) {
 		/* Obey programmer limit... */
-		block_len = min(len, flash->mst->opaque.max_data_read);
+		block_len = min(len, flash->mst.opaque->max_data_read);
 		/* as well as flash chip page borders as demanded in the Intel datasheets. */
 		block_len = min(block_len, 256 - (addr & 0xFF));
 
@@ -1490,7 +1490,7 @@
 	while (len > 0) {
 		ich_hwseq_set_addr(addr);
 		/* Obey programmer limit... */
-		block_len = min(len, flash->mst->opaque.max_data_write);
+		block_len = min(len, flash->mst.opaque->max_data_write);
 		/* as well as flash chip page borders as demanded in the Intel datasheets. */
 		block_len = min(block_len, 256 - (addr & 0xFF));
 		ich_fill_data(buf, block_len, ICH9_REG_FDATA0);