soc/imgtec/pistachio: 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: Ie4ec74fccaf25900537ccd5c146bb0a333a2754c Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://review.coreboot.org/19772 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
parent
23d5d99098
commit
e173ee8f01
|
@ -533,22 +533,13 @@ static int spi_ctrlr_xfer(const struct spi_slave *slave, const void *dout,
|
|||
return SPIM_OK;
|
||||
}
|
||||
|
||||
static const struct spi_ctrlr spi_ctrlr = {
|
||||
.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 = IMGTEC_SPI_MAX_TRANSFER_SIZE,
|
||||
};
|
||||
|
||||
/* Set up communications parameters for a SPI slave. */
|
||||
int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave)
|
||||
static int spi_ctrlr_setup(const struct spi_slave *slave)
|
||||
{
|
||||
struct img_spi_slave *img_slave = NULL;
|
||||
struct spim_device_parameters *device_parameters;
|
||||
u32 base;
|
||||
|
||||
switch (bus) {
|
||||
switch (slave->bus) {
|
||||
case 0:
|
||||
base = IMG_SPIM0_BASE_ADDRESS;
|
||||
break;
|
||||
|
@ -560,16 +551,12 @@ int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave)
|
|||
__func__);
|
||||
return -1;
|
||||
}
|
||||
if (cs > SPIM_DEVICE4) {
|
||||
if (slave->cs > SPIM_DEVICE4) {
|
||||
printk(BIOS_ERR, "%s: Error: unsupported chipselect.\n",
|
||||
__func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
slave->bus = bus;
|
||||
slave->cs = cs;
|
||||
slave->ctrlr = &spi_ctrlr;
|
||||
|
||||
img_slave = get_img_slave(slave);
|
||||
device_parameters = &(img_slave->device_parameters);
|
||||
|
||||
|
@ -586,3 +573,22 @@ int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave)
|
|||
|
||||
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 = IMGTEC_SPI_MAX_TRANSFER_SIZE,
|
||||
};
|
||||
|
||||
const struct spi_ctrlr_buses spi_ctrlr_bus_map[] = {
|
||||
{
|
||||
.ctrlr = &spi_ctrlr,
|
||||
.bus_start = 0,
|
||||
.bus_end = 1,
|
||||
},
|
||||
};
|
||||
|
||||
const size_t spi_ctrlr_bus_map_count = ARRAY_SIZE(spi_ctrlr_bus_map);
|
||||
|
|
Loading…
Reference in New Issue