diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-01-11 14:35:53 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-02-04 08:25:49 -0500 |
commit | c8ebae37034c0ead62eb4df8ef88e999ddb8d5cf (patch) | |
tree | c9925f03a9c627d7408ef483d7920e25a927e633 /include/linux/amba | |
parent | 51d4375dd72f352594f1a4f1d7598bf9a75b8dfe (diff) |
ARM: mmci: add dmaengine-based DMA support
Based on a patch from Linus Walleij.
Add dmaengine based support for DMA to the MMCI driver, using the
Primecell DMA engine interface. The changes over Linus' driver are:
- rename txsize_threshold to dmasize_threshold, as this reflects the
purpose more.
- use 'mmci_dma_' as the function prefix rather than 'dma_mmci_'.
- clean up requesting of dma channels.
- don't release a single channel twice when it's shared between tx and rx.
- get rid of 'dma_enable' bool - instead check whether the channel is NULL.
- detect incomplete DMA at the end of a transfer. Some DMA controllers
(eg, PL08x) are unable to be configured for scatter DMA and also listen
to all four DMA request signals [BREQ,SREQ,LBREQ,LSREQ] from the MMCI.
They can do one or other but not both. As MMCI uses LBREQ/LSREQ for the
final burst/words, PL08x does not transfer the last few words.
- map and unmap DMA buffers using the DMA engine struct device, not the
MMCI struct device - the DMA engine is doing the DMA transfer, not us.
- avoid double-unmapping of the DMA buffers on MMCI data errors.
- don't check for negative values from the dmaengine tx submission
function - Dan says this must never fail.
- use new dmaengine helper functions rather than using the ugly function
pointers directly.
- allow DMA code to be fully optimized away using dma_inprogress() which
is defined to constant 0 if DMA engine support is disabled.
- request maximum segment size from the DMA engine struct device and
set this appropriately.
- removed checking of buffer alignment - the DMA engine should deal with
its own restrictions on buffer alignment, not the individual DMA engine
users.
- removed setting DMAREQCTL - this confuses some DMA controllers as it
causes LBREQ to be asserted for the last seven transfers, rather than
six SREQ and one LSREQ.
- removed burst setting - the DMA controller should not burst past the
transfer size required to complete the DMA operation.
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'include/linux/amba')
-rw-r--r-- | include/linux/amba/mmci.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h index f4ee9acc9721..f60227088b7b 100644 --- a/include/linux/amba/mmci.h +++ b/include/linux/amba/mmci.h | |||
@@ -6,6 +6,9 @@ | |||
6 | 6 | ||
7 | #include <linux/mmc/host.h> | 7 | #include <linux/mmc/host.h> |
8 | 8 | ||
9 | /* Just some dummy forwarding */ | ||
10 | struct dma_chan; | ||
11 | |||
9 | /** | 12 | /** |
10 | * struct mmci_platform_data - platform configuration for the MMCI | 13 | * struct mmci_platform_data - platform configuration for the MMCI |
11 | * (also known as PL180) block. | 14 | * (also known as PL180) block. |
@@ -27,6 +30,17 @@ | |||
27 | * @cd_invert: true if the gpio_cd pin value is active low | 30 | * @cd_invert: true if the gpio_cd pin value is active low |
28 | * @capabilities: the capabilities of the block as implemented in | 31 | * @capabilities: the capabilities of the block as implemented in |
29 | * this platform, signify anything MMC_CAP_* from mmc/host.h | 32 | * this platform, signify anything MMC_CAP_* from mmc/host.h |
33 | * @dma_filter: function used to select an apropriate RX and TX | ||
34 | * DMA channel to be used for DMA, if and only if you're deploying the | ||
35 | * generic DMA engine | ||
36 | * @dma_rx_param: parameter passed to the DMA allocation | ||
37 | * filter in order to select an apropriate RX channel. If | ||
38 | * there is a bidirectional RX+TX channel, then just specify | ||
39 | * this and leave dma_tx_param set to NULL | ||
40 | * @dma_tx_param: parameter passed to the DMA allocation | ||
41 | * filter in order to select an apropriate TX channel. If this | ||
42 | * is NULL the driver will attempt to use the RX channel as a | ||
43 | * bidirectional channel | ||
30 | */ | 44 | */ |
31 | struct mmci_platform_data { | 45 | struct mmci_platform_data { |
32 | unsigned int f_max; | 46 | unsigned int f_max; |
@@ -38,6 +52,9 @@ struct mmci_platform_data { | |||
38 | int gpio_cd; | 52 | int gpio_cd; |
39 | bool cd_invert; | 53 | bool cd_invert; |
40 | unsigned long capabilities; | 54 | unsigned long capabilities; |
55 | bool (*dma_filter)(struct dma_chan *chan, void *filter_param); | ||
56 | void *dma_rx_param; | ||
57 | void *dma_tx_param; | ||
41 | }; | 58 | }; |
42 | 59 | ||
43 | #endif | 60 | #endif |