spi: Provide core support for full duplex devices
authorMark Brown <broonie@linaro.org>
Tue, 28 Jan 2014 20:17:03 +0000 (20:17 +0000)
committerStephane Desneux <stephane.desneux@open.eurogiciel.org>
Wed, 4 Feb 2015 10:13:25 +0000 (11:13 +0100)
commit1d48a4fb0249b5e9ee3059572af9d9767f744c88
tree5e3f166ef8f49153bb2924f0b85f63d476a1dd3f
parent7c243759ed9753309f2361563f21b4eb1f959618
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)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
drivers/spi/spi.c
include/linux/spi/spi.h