soc/broadcom/cygnus: Move spi driver to use spi_bus_map

This is in preparation to get rid of the strong spi_setup_slave
implemented by different platforms.

BUG=b:38430839

Change-Id: I48b242dd6226e392ed0f403051843b3ae02cd9a4
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://review.coreboot.org/19773
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Philippe Mathieu-Daudé <philippe.mathieu.daude@gmail.com>
This commit is contained in:
Furquan Shaikh 2017-05-18 14:11:04 -07:00 committed by Furquan Shaikh
parent e173ee8f01
commit 56c88ebc02
1 changed files with 20 additions and 13 deletions

View File

@ -275,23 +275,11 @@ static int spi_ctrlr_xfer(const struct spi_slave *slave, const void *dout,
return 0; return 0;
} }
static const struct spi_ctrlr spi_ctrlr = { static int spi_ctrlr_setup(const struct spi_slave *slave)
.claim_bus = spi_ctrlr_claim_bus,
.release_bus = spi_ctrlr_release_bus,
.xfer = spi_ctrlr_xfer,
.xfer_vector = spi_xfer_two_vectors,
.max_xfer_size = 65535,
};
int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave)
{ {
struct qspi_priv *priv = &qspi_slave; struct qspi_priv *priv = &qspi_slave;
unsigned int spbr; unsigned int spbr;
slave->bus = bus;
slave->cs = cs;
slave->ctrlr = &spi_ctrlr;
priv->max_hz = QSPI_MAX_HZ; priv->max_hz = QSPI_MAX_HZ;
priv->spi_mode = QSPI_MODE; priv->spi_mode = QSPI_MODE;
priv->reg = (void *)(IPROC_QSPI_BASE); priv->reg = (void *)(IPROC_QSPI_BASE);
@ -319,3 +307,22 @@ int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave)
return 0; return 0;
} }
static const struct spi_ctrlr spi_ctrlr = {
.setup = spi_ctrlr_setup,
.claim_bus = spi_ctrlr_claim_bus,
.release_bus = spi_ctrlr_release_bus,
.xfer = spi_ctrlr_xfer,
.xfer_vector = spi_xfer_two_vectors,
.max_xfer_size = 65535,
};
const struct spi_ctrlr_buses spi_ctrlr_bus_map[] = {
{
.ctrlr = &spi_ctrlr,
.bus_start = CONFIG_BOOT_DEVICE_SPI_FLASH_BUS,
.bus_end = CONFIG_BOOT_DEVICE_SPI_FLASH_BUS,
},
};
const size_t spi_ctrlr_bus_map_count = ARRAY_SIZE(spi_ctrlr_bus_map);