1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-01 06:01:16 +02:00

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>
This commit is contained in:
Anastasia Klimchuk
2021-07-06 16:03:11 +10:00
committed by Nico Huber
parent 5a97be363a
commit 0a7f036610
14 changed files with 184 additions and 188 deletions

View File

@ -385,20 +385,6 @@ static int ch341a_spi_spi_send_command(const struct flashctx *flash, unsigned in
return 0;
}
static const struct spi_master spi_master_ch341a_spi = {
.features = SPI_MASTER_4BA,
/* flashrom's current maximum is 256 B. CH341A was tested on Linux and Windows to accept atleast
* 128 kB. Basically there should be no hard limit because transfers are broken up into USB packets
* sent to the device and most of their payload streamed via SPI. */
.max_data_read = 4 * 1024,
.max_data_write = 4 * 1024,
.command = ch341a_spi_spi_send_command,
.multicommand = default_spi_send_multicommand,
.read = default_spi_read,
.write_256 = default_spi_write_256,
.write_aai = default_spi_write_aai,
};
static int ch341a_spi_shutdown(void *data)
{
if (handle == NULL)
@ -419,6 +405,20 @@ static int ch341a_spi_shutdown(void *data)
return 0;
}
static const struct spi_master spi_master_ch341a_spi = {
.features = SPI_MASTER_4BA,
/* flashrom's current maximum is 256 B. CH341A was tested on Linux and Windows to accept atleast
* 128 kB. Basically there should be no hard limit because transfers are broken up into USB packets
* sent to the device and most of their payload streamed via SPI. */
.max_data_read = 4 * 1024,
.max_data_write = 4 * 1024,
.command = ch341a_spi_spi_send_command,
.multicommand = default_spi_send_multicommand,
.read = default_spi_read,
.write_256 = default_spi_write_256,
.write_aai = default_spi_write_aai,
};
static int ch341a_spi_init(void)
{
if (handle != NULL) {