summaryrefslogtreecommitdiffstats
path: root/buspirate_spi.c
diff options
context:
space:
mode:
authorAnastasia Klimchuk <aklm@chromium.org>2021-07-06 16:03:11 +1000
committerNico Huber <nico.h@gmx.de>2021-08-17 09:39:18 +0000
commit0a7f036610673f6664c9d1492912abfdfbdf9f20 (patch)
treeca67f6d90b777debae831039267adfcab01c18d9 /buspirate_spi.c
parent5a97be363a269b364569be8223369d9a5bf92292 (diff)
downloadflashrom-0a7f036610673f6664c9d1492912abfdfbdf9f20.tar.gz
flashrom-0a7f036610673f6664c9d1492912abfdfbdf9f20.tar.bz2
flashrom-0a7f036610673f6664c9d1492912abfdfbdf9f20.zip
spi_master: Move shutdown function above spi_master struct
This patch prepares spi masters to use new API which allows to register shutdown function in spi_master struct. See also later patch in this chain, where spi masters are converted to new API. BUG=b:185191942 TEST=builds and ninja test Comparing flashrom binary before and after the patch, make clean && make CONFIG_EVERYTHING=yes VERSION=none binary is the same Change-Id: I50716686552b4ddcc6089d5afadb19ef59d9f9b4 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56101 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'buspirate_spi.c')
-rw-r--r--buspirate_spi.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/buspirate_spi.c b/buspirate_spi.c
index b56d422bd..3c0a6ff92 100644
--- a/buspirate_spi.c
+++ b/buspirate_spi.c
@@ -130,38 +130,6 @@ static int buspirate_wait_for_string(unsigned char *buf, const char *key)
return ret;
}
-static struct spi_master spi_master_buspirate = {
- .features = SPI_MASTER_4BA,
- .max_data_read = MAX_DATA_UNSPECIFIED,
- .max_data_write = MAX_DATA_UNSPECIFIED,
- .command = NULL,
- .multicommand = default_spi_send_multicommand,
- .read = default_spi_read,
- .write_256 = default_spi_write_256,
- .write_aai = default_spi_write_aai,
-};
-
-static const struct buspirate_speeds spispeeds[] = {
- {"30k", 0x0},
- {"125k", 0x1},
- {"250k", 0x2},
- {"1M", 0x3},
- {"2M", 0x4},
- {"2.6M", 0x5},
- {"4M", 0x6},
- {"8M", 0x7},
- {NULL, 0x0}
-};
-
-static const struct buspirate_speeds serialspeeds[] = {
- {"115200", 115200},
- {"230400", 230400},
- {"250000", 250000},
- {"2000000", 2000000},
- {"2M", 2000000},
- {NULL, 0}
-};
-
static int buspirate_spi_shutdown(void *data)
{
struct bp_spi_data *bp_data = data;
@@ -204,6 +172,38 @@ out_shutdown:
return ret;
}
+static struct spi_master spi_master_buspirate = {
+ .features = SPI_MASTER_4BA,
+ .max_data_read = MAX_DATA_UNSPECIFIED,
+ .max_data_write = MAX_DATA_UNSPECIFIED,
+ .command = NULL,
+ .multicommand = default_spi_send_multicommand,
+ .read = default_spi_read,
+ .write_256 = default_spi_write_256,
+ .write_aai = default_spi_write_aai,
+};
+
+static const struct buspirate_speeds spispeeds[] = {
+ {"30k", 0x0},
+ {"125k", 0x1},
+ {"250k", 0x2},
+ {"1M", 0x3},
+ {"2M", 0x4},
+ {"2.6M", 0x5},
+ {"4M", 0x6},
+ {"8M", 0x7},
+ {NULL, 0x0}
+};
+
+static const struct buspirate_speeds serialspeeds[] = {
+ {"115200", 115200},
+ {"230400", 230400},
+ {"250000", 250000},
+ {"2000000", 2000000},
+ {"2M", 2000000},
+ {NULL, 0}
+};
+
static int buspirate_spi_send_command_v1(const struct flashctx *flash, unsigned int writecnt, unsigned int readcnt,
const unsigned char *writearr, unsigned char *readarr)
{