From b46e9f602939c7cddf17bb38541fc5a59f2fe6c8 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Thu, 18 May 2017 10:46:46 -0700 Subject: soc/nvidia/tegra*: Move spi driver to use spi_bus_map MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is in preparation to get rid of the strong spi_setup_slave implemented by different platforms. BUG=b:38430839 Change-Id: I873b96d286655a814554bfd89f899ee87302b06d Signed-off-by: Furquan Shaikh Reviewed-on: https://review.coreboot.org/19769 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner Reviewed-by: Aaron Durbin Reviewed-by: Philippe Mathieu-Daudé --- src/soc/nvidia/tegra124/spi.c | 19 ++++++++----------- src/soc/nvidia/tegra210/spi.c | 19 ++++++++----------- 2 files changed, 16 insertions(+), 22 deletions(-) (limited to 'src/soc/nvidia') diff --git a/src/soc/nvidia/tegra124/spi.c b/src/soc/nvidia/tegra124/spi.c index 4ecd67a8a4..ae07d53fed 100644 --- a/src/soc/nvidia/tegra124/spi.c +++ b/src/soc/nvidia/tegra124/spi.c @@ -800,15 +800,12 @@ static const struct spi_ctrlr spi_ctrlr = { .max_xfer_size = SPI_CTRLR_DEFAULT_MAX_XFER_SIZE, }; -int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave) -{ - struct tegra_spi_channel *channel = to_tegra_spi(bus); - if (!channel) - return -1; - - slave->bus = channel->slave.bus; - slave->cs = channel->slave.cs; - slave->ctrlr = &spi_ctrlr; +const struct spi_ctrlr_buses spi_ctrlr_bus_map[] = { + { + .ctrlr = &spi_ctrlr, + .bus_start = 1, + .bus_end = ARRAY_SIZE(tegra_spi_channels) + }, +}; - return 0; -} +const size_t spi_ctrlr_bus_map_count = ARRAY_SIZE(spi_ctrlr_bus_map); diff --git a/src/soc/nvidia/tegra210/spi.c b/src/soc/nvidia/tegra210/spi.c index 0987ddb53a..54e46f13d6 100644 --- a/src/soc/nvidia/tegra210/spi.c +++ b/src/soc/nvidia/tegra210/spi.c @@ -836,15 +836,12 @@ static const struct spi_ctrlr spi_ctrlr = { .max_xfer_size = SPI_CTRLR_DEFAULT_MAX_XFER_SIZE, }; -int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave) -{ - struct tegra_spi_channel *channel = to_tegra_spi(bus); - if (!channel) - return -1; - - slave->cs = channel->slave.cs; - slave->bus = channel->slave.bus; - slave->ctrlr = &spi_ctrlr; +const struct spi_ctrlr_buses spi_ctrlr_bus_map[] = { + { + .ctrlr = &spi_ctrlr, + .bus_start = 1, + .bus_end = ARRAY_SIZE(tegra_spi_channels) + }, +}; - return 0; -} +const size_t spi_ctrlr_bus_map_count = ARRAY_SIZE(spi_ctrlr_bus_map); -- cgit v1.2.3