bitbang: Extend register_spi_bitbang_master() API with spi data
This allows the users of register_spi_bitbang_master() API to pass
their spi data into the API, and then the data can go further, into
register_spi_master() API.
flashrom-stable: Removed unnecessary if.
Change-Id: I13e83ae74dbc3a3e79c84d1463683d360ff47bc0
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/54990
Original-Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/73267
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/bitbang_spi.c b/bitbang_spi.c
index 91f48a9..ef9e77c 100644
--- a/bitbang_spi.c
+++ b/bitbang_spi.c
@@ -23,6 +23,7 @@
struct bitbang_spi_master_data {
const struct bitbang_spi_master *mst;
+ void *spi_data;
};
/* Note that CS# is active low, so val=0 means the chip is active. */
@@ -93,7 +94,7 @@
return 0;
}
-int register_spi_bitbang_master(const struct bitbang_spi_master *master)
+int register_spi_bitbang_master(const struct bitbang_spi_master *master, void *spi_data)
{
struct spi_master mst = spi_master_bitbang;
/* If someone forgot to initialize a bitbang function, we catch it here. */
@@ -113,6 +114,7 @@
}
data->mst = master;
+ data->spi_data = spi_data;
register_spi_master(&mst, data);
/* Only mess with the bus if we're sure nobody else uses it. */