diff options
author | Mark Brown <broonie@linaro.org> | 2014-01-28 20:17:03 +0000 |
---|---|---|
committer | Robin Gong <b38343@freescale.com> | 2014-10-20 08:29:55 +0800 |
commit | d88018dac8450a46cf68d5bd9711bf71cc751e8d (patch) | |
tree | 77b04194686add8b45141a05309ad666ab031cc7 /include/linux | |
parent | 0f07ad70af97c144222c3d7b7cc73fa7d2f8f549 (diff) |
spi: Provide core support for full duplex devices
It is fairly common for SPI devices to require that one or both transfer
directions is always active. Currently drivers open code this in various
ways with varying degrees of efficiency. Start factoring this out by
providing flags SPI_MASTER_MUST_TX and SPI_MASTER_MUST_RX. These will cause
the core to provide buffers for the requested direction if none are
specified in the underlying transfer.
Currently this is fairly inefficient since we actually allocate a data
buffer which may get large, support for mapping transfers using a
scatterlist will allow us to avoid this for DMA based transfers.
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 3a2eba9bd0a6447dfbc01635e4cd0689f5f2bdad)
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/spi/spi.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index ec0c6328bfd4..6e67d17a1c88 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -345,6 +345,8 @@ struct spi_master { #define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */ #define SPI_MASTER_NO_RX BIT(1) /* can't do buffer read */ #define SPI_MASTER_NO_TX BIT(2) /* can't do buffer write */ +#define SPI_MASTER_MUST_RX BIT(3) /* requires rx */ +#define SPI_MASTER_MUST_TX BIT(4) /* requires tx */ /* lock and mutex for SPI bus locking */ spinlock_t bus_lock_spinlock; @@ -441,6 +443,10 @@ struct spi_master { /* DMA channels for use with core dmaengine helpers */ struct dma_chan *dma_tx; struct dma_chan *dma_rx; + + /* dummy data for full duplex devices */ + void *dummy_rx; + void *dummy_tx; }; static inline void *spi_master_get_devdata(struct spi_master *master) |