diff options
author | Gary King <gking@nvidia.com> | 2010-04-13 10:27:48 -0700 |
---|---|---|
committer | Gary King <gking@nvidia.com> | 2010-04-15 13:42:00 -0700 |
commit | 189f352462e8963d9decb872f2acdfb45f7d29c2 (patch) | |
tree | b1a92a77c607b568ffcb8875d3e87554b78dd830 | |
parent | cf713118ae8dec4e9708f26005f65a67a1e19794 (diff) |
[spi] update tegra driver to support multiple slaves
the spi clock, chip select and bits per word need to be applied
from the spi slave device specified in the transaction
previously, the values were constant for each master, and corresponded
to the last device registered on the bus
issue originally reported by Mike Corrigan
Change-Id: I047b6aa6d92f2c9e134311d3d32bcb75d5f689f5
Reviewed-on: http://git-master/r/1102
Reviewed-by: Venkata (Muni) Anda <vanda@nvidia.com>
Tested-by: Venkata (Muni) Anda <vanda@nvidia.com>
-rw-r--r-- | drivers/spi/tegra_spi.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/spi/tegra_spi.c b/drivers/spi/tegra_spi.c index 3bacf8554f27..95e85f5245da 100644 --- a/drivers/spi/tegra_spi.c +++ b/drivers/spi/tegra_spi.c @@ -163,7 +163,10 @@ static void tegra_spi_workerthread(struct work_struct *w) int status = 0; NvRmSpiTransactionInfo trans[64]; NvU32 i= 0; - NvU32 actual_length = 0; + NvU32 actual_length = 0; + NvU32 BitsPerWord; + NvU32 ClockInKHz; + NvU32 ChipSelect; m = container_of(pShimSpi->msg_queue.next, struct spi_message, queue); @@ -193,10 +196,21 @@ static void tegra_spi_workerthread(struct work_struct *w) i++; } + + if (!m->spi) { + status = -EINVAL; + break; + } + + /* Get slave config. PinMuxConfig is a property of the master. */ + BitsPerWord = m->spi->bits_per_word; + ClockInKHz = m->spi->max_speed_hz / 1000; + ChipSelect = m->spi->chip_select; + if (!status && i) { NvRmSpiMultipleTransactions(pShimSpi->hSpi, - pShimSpi->PinMuxConfig, pShimSpi->ChipSelect, - pShimSpi->ClockInKHz, pShimSpi->BitsPerWord, + pShimSpi->PinMuxConfig, ChipSelect, + ClockInKHz, BitsPerWord, trans, i); m->actual_length += actual_length; |