mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
UPSTREAM: soc/samsung/exynos5420: 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: I76ceda11937839f758cd7c2b48f9164c5ee5d109
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Original-Commit-Id: f8662ca3bc
Original-Change-Id: Ic937cbf93b87f5e43f7d70140b47fa97bcd7757e
Original-Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Original-Reviewed-on: https://review.coreboot.org/19777
Original-Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Original-Reviewed-by: Philippe Mathieu-Daud <philippe.mathieu.daude@gmail.com>
Reviewed-on: https://chromium-review.googlesource.com/514184
Commit-Ready: Patrick Georgi <pgeorgi@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
This commit is contained in:
parent
daea2a9a13
commit
6f28b51a65
1 changed files with 20 additions and 13 deletions
|
@ -208,22 +208,11 @@ static void spi_ctrlr_release_bus(const struct spi_slave *slave)
|
||||||
setbits_le32(®s->cs_reg, SPI_SLAVE_SIG_INACT);
|
setbits_le32(®s->cs_reg, SPI_SLAVE_SIG_INACT);
|
||||||
}
|
}
|
||||||
|
|
||||||
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,
|
|
||||||
.max_xfer_size = SPI_CTRLR_DEFAULT_MAX_XFER_SIZE,
|
|
||||||
};
|
|
||||||
|
|
||||||
int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave)
|
|
||||||
{
|
{
|
||||||
ASSERT(bus >= 0 && bus < 3);
|
ASSERT(slave->bus >= 0 && slave->bus < 3);
|
||||||
struct exynos_spi_slave *eslave;
|
struct exynos_spi_slave *eslave;
|
||||||
|
|
||||||
slave->bus = bus;
|
|
||||||
slave->cs = cs;
|
|
||||||
slave->ctrlr = &spi_ctrlr;
|
|
||||||
|
|
||||||
eslave = to_exynos_spi(slave);
|
eslave = to_exynos_spi(slave);
|
||||||
if (!eslave->initialized) {
|
if (!eslave->initialized) {
|
||||||
exynos_spi_init(eslave->regs);
|
exynos_spi_init(eslave->regs);
|
||||||
|
@ -232,6 +221,24 @@ 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,
|
||||||
|
.max_xfer_size = SPI_CTRLR_DEFAULT_MAX_XFER_SIZE,
|
||||||
|
};
|
||||||
|
|
||||||
|
const struct spi_ctrlr_buses spi_ctrlr_bus_map[] = {
|
||||||
|
{
|
||||||
|
.ctrlr = &spi_ctrlr,
|
||||||
|
.bus_start = 0,
|
||||||
|
.bus_end = 2,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const size_t spi_ctrlr_bus_map_count = ARRAY_SIZE(spi_ctrlr_bus_map);
|
||||||
|
|
||||||
static int exynos_spi_read(struct spi_slave *slave, void *dest, uint32_t len,
|
static int exynos_spi_read(struct spi_slave *slave, void *dest, uint32_t len,
|
||||||
uint32_t off)
|
uint32_t off)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue