]> git.karo-electronics.de Git - karo-tx-linux.git/commit
spi: Make core DMA mapping functions generate scatterlists
authorMark Brown <broonie@linaro.org>
Sun, 2 Feb 2014 13:47:47 +0000 (13:47 +0000)
committerMark Brown <broonie@linaro.org>
Tue, 4 Feb 2014 20:31:49 +0000 (20:31 +0000)
commit6ad45a27cbe343ec8d7888e5edf6335499a4b555
treeb24da97af83e92bdb2a1e0805b8c80d6baedb14e
parent3a2eba9bd0a6447dfbc01635e4cd0689f5f2bdad
spi: Make core DMA mapping functions generate scatterlists

We cannot unconditionally use dma_map_single() to map data for use with
SPI since transfers may exceed a page and virtual addresses may not be
provided with physically contiguous pages. Further, addresses allocated
using vmalloc() need to be mapped differently to other addresses.

Currently only the MXS driver handles all this, a few drivers do handle
the possibility that buffers may not be physically contiguous which is
the main potential problem but many don't even do that. Factoring this
out into the core will make it easier for drivers to do a good job so if
the driver is using the core DMA code then generate a scatterlist
instead of mapping to a single address so do that.

This code is mainly based on a combination of the existing code in the MXS
and PXA2xx drivers. In future we should be able to extend it to allow the
core to concatenate adjacent transfers if they are compatible, improving
performance.

Currently for simplicity clients are not allowed to use the scatterlist
when they do DMA mapping, in the future the existing single address
mappings will be replaced with use of the scatterlist most likely as
part of pre-verifying transfers.

This change makes it mandatory to use scatterlists when using the core DMA
mapping so update the s3c64xx driver to do this when used with dmaengine.
Doing so makes the code more ugly but it is expected that the old s3c-dma
code can be removed very soon.

Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/spi/spi-s3c64xx.c
drivers/spi/spi.c
include/linux/spi/spi.h