mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-02 14:33:18 +02:00
bitbang: Extend bitbang_spi_master functions to accept spi data
This way every bitbang spi master has access to its own spi data, and can use this data in all its functions. This patch only changes the signatures of functions. BUG=b:185191942 TEST=builds Change-Id: Id5722a43ce20feeed62630ad80e14df7744f9c02 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/54991 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
This commit is contained in:

committed by
Edward O'Callaghan

parent
30815fc370
commit
5f5eaeb7fa
12
mcp6x_spi.c
12
mcp6x_spi.c
@ -41,7 +41,7 @@ static void *mcp6x_spibar = NULL;
|
||||
/* Cached value of last GPIO state. */
|
||||
static uint8_t mcp_gpiostate;
|
||||
|
||||
static void mcp6x_request_spibus(void)
|
||||
static void mcp6x_request_spibus(void *spi_data)
|
||||
{
|
||||
mcp_gpiostate = mmio_readb(mcp6x_spibar + 0x530);
|
||||
mcp_gpiostate |= 1 << MCP6X_SPI_REQUEST;
|
||||
@ -54,34 +54,34 @@ static void mcp6x_request_spibus(void)
|
||||
mcp_gpiostate = mmio_readb(mcp6x_spibar + 0x530);
|
||||
}
|
||||
|
||||
static void mcp6x_release_spibus(void)
|
||||
static void mcp6x_release_spibus(void *spi_data)
|
||||
{
|
||||
mcp_gpiostate &= ~(1 << MCP6X_SPI_REQUEST);
|
||||
mmio_writeb(mcp_gpiostate, mcp6x_spibar + 0x530);
|
||||
}
|
||||
|
||||
static void mcp6x_bitbang_set_cs(int val)
|
||||
static void mcp6x_bitbang_set_cs(int val, void *spi_data)
|
||||
{
|
||||
mcp_gpiostate &= ~(1 << MCP6X_SPI_CS);
|
||||
mcp_gpiostate |= (val << MCP6X_SPI_CS);
|
||||
mmio_writeb(mcp_gpiostate, mcp6x_spibar + 0x530);
|
||||
}
|
||||
|
||||
static void mcp6x_bitbang_set_sck(int val)
|
||||
static void mcp6x_bitbang_set_sck(int val, void *spi_data)
|
||||
{
|
||||
mcp_gpiostate &= ~(1 << MCP6X_SPI_SCK);
|
||||
mcp_gpiostate |= (val << MCP6X_SPI_SCK);
|
||||
mmio_writeb(mcp_gpiostate, mcp6x_spibar + 0x530);
|
||||
}
|
||||
|
||||
static void mcp6x_bitbang_set_mosi(int val)
|
||||
static void mcp6x_bitbang_set_mosi(int val, void *spi_data)
|
||||
{
|
||||
mcp_gpiostate &= ~(1 << MCP6X_SPI_MOSI);
|
||||
mcp_gpiostate |= (val << MCP6X_SPI_MOSI);
|
||||
mmio_writeb(mcp_gpiostate, mcp6x_spibar + 0x530);
|
||||
}
|
||||
|
||||
static int mcp6x_bitbang_get_miso(void)
|
||||
static int mcp6x_bitbang_get_miso(void *spi_data)
|
||||
{
|
||||
mcp_gpiostate = mmio_readb(mcp6x_spibar + 0x530);
|
||||
return (mcp_gpiostate >> MCP6X_SPI_MISO) & 0x1;
|
||||
|
Reference in New Issue
Block a user