summaryrefslogtreecommitdiffstats
path: root/bitbang_spi.c
diff options
context:
space:
mode:
authorAnastasia Klimchuk <aklm@chromium.org>2021-05-31 11:20:01 +1000
committerEdward O'Callaghan <quasisec@chromium.org>2021-06-03 05:19:24 +0000
commit30815fc3706194117c633393d1ed65941a5afafd (patch)
tree0057efa0d621d30e4b511a15cbaafc8d65c2da5f /bitbang_spi.c
parent0bc0ab932eea6c8a60e90f9abe41c79758d2b8cb (diff)
downloadflashrom-30815fc3706194117c633393d1ed65941a5afafd.tar.gz
flashrom-30815fc3706194117c633393d1ed65941a5afafd.tar.bz2
flashrom-30815fc3706194117c633393d1ed65941a5afafd.zip
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. BUG=b:185191942 TEST=builds Change-Id: I13e83ae74dbc3a3e79c84d1463683d360ff47bc0 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/54990 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Diffstat (limited to 'bitbang_spi.c')
-rw-r--r--bitbang_spi.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/bitbang_spi.c b/bitbang_spi.c
index e70d883e9..e595b16f9 100644
--- a/bitbang_spi.c
+++ b/bitbang_spi.c
@@ -96,6 +96,7 @@ static void bitbang_spi_write_byte(const struct bitbang_spi_master *master, uint
struct bitbang_spi_master_data {
const struct bitbang_spi_master *master;
+ void *spi_data;
};
static int bitbang_spi_send_command(const struct flashctx *flash,
@@ -146,7 +147,7 @@ static int bitbang_spi_shutdown(void *data)
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. */
@@ -161,6 +162,9 @@ int register_spi_bitbang_master(const struct bitbang_spi_master *master)
struct bitbang_spi_master_data *data = calloc(1, sizeof(struct bitbang_spi_master_data));
data->master = master;
+ if (spi_data)
+ data->spi_data = spi_data;
+
register_spi_master(&mst, data);
register_shutdown(bitbang_spi_shutdown, data);