aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLudovic Desroches <ludovic.desroches@atmel.com>2013-06-13 04:39:39 -0400
committerVinod Koul <vinod.koul@intel.com>2013-07-05 02:10:54 -0400
commit62971b29825adb06908bad81e7679d1f7904b24d (patch)
tree6b2c29be1793d6c60ac80a4abc8686aee10dcc47
parent764037c6f55c5c844d0ab6049e6e7c0dc3cb7665 (diff)
dmaengine: at_hdmac: add FIFO configuration parameter to DMA DT binding
For most devices the FIFO configuration is the same i.e. when half FIFO size is available/filled, a source/destination request is serviced. But USART devices have to do it when there is enough space/data available to perform a single AHB access so the ASAP configuration. Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
-rw-r--r--Documentation/devicetree/bindings/dma/atmel-dma.txt7
-rw-r--r--drivers/dma/at_hdmac.c25
2 files changed, 26 insertions, 6 deletions
diff --git a/Documentation/devicetree/bindings/dma/atmel-dma.txt b/Documentation/devicetree/bindings/dma/atmel-dma.txt
index c80e8a3402f0..c280a0e6f42d 100644
--- a/Documentation/devicetree/bindings/dma/atmel-dma.txt
+++ b/Documentation/devicetree/bindings/dma/atmel-dma.txt
@@ -24,8 +24,11 @@ The three cells in order are:
241. A phandle pointing to the DMA controller. 241. A phandle pointing to the DMA controller.
252. The memory interface (16 most significant bits), the peripheral interface 252. The memory interface (16 most significant bits), the peripheral interface
26(16 less significant bits). 26(16 less significant bits).
273. The peripheral identifier for the hardware handshaking interface. The 273. Parameters for the at91 DMA configuration register which are device
28identifier can be different for tx and rx. 28dependant:
29 - bit 7-0: peripheral identifier for the hardware handshaking interface. The
30 identifier can be different for tx and rx.
31 - bit 11-8: FIFO configuration. 0 for half FIFO, 1 for ALAP, 1 for ASAP.
29 32
30Example: 33Example:
31 34
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 6db5228f4134..b7050a46bd87 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -14,6 +14,7 @@
14 * found on AT91SAM9263. 14 * found on AT91SAM9263.
15 */ 15 */
16 16
17#include <dt-bindings/dma/at91.h>
17#include <linux/clk.h> 18#include <linux/clk.h>
18#include <linux/dmaengine.h> 19#include <linux/dmaengine.h>
19#include <linux/dma-mapping.h> 20#include <linux/dma-mapping.h>
@@ -1320,15 +1321,31 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec,
1320 atslave = devm_kzalloc(&dmac_pdev->dev, sizeof(*atslave), GFP_KERNEL); 1321 atslave = devm_kzalloc(&dmac_pdev->dev, sizeof(*atslave), GFP_KERNEL);
1321 if (!atslave) 1322 if (!atslave)
1322 return NULL; 1323 return NULL;
1324
1325 atslave->cfg = ATC_DST_H2SEL_HW | ATC_SRC_H2SEL_HW;
1323 /* 1326 /*
1324 * We can fill both SRC_PER and DST_PER, one of these fields will be 1327 * We can fill both SRC_PER and DST_PER, one of these fields will be
1325 * ignored depending on DMA transfer direction. 1328 * ignored depending on DMA transfer direction.
1326 */ 1329 */
1327 per_id = dma_spec->args[1]; 1330 per_id = dma_spec->args[1] & AT91_DMA_CFG_PER_ID_MASK;
1328 atslave->cfg = ATC_FIFOCFG_HALFFIFO 1331 atslave->cfg |= ATC_DST_PER_MSB(per_id) | ATC_DST_PER(per_id)
1329 | ATC_DST_H2SEL_HW | ATC_SRC_H2SEL_HW
1330 | ATC_DST_PER_MSB(per_id) | ATC_DST_PER(per_id)
1331 | ATC_SRC_PER_MSB(per_id) | ATC_SRC_PER(per_id); 1332 | ATC_SRC_PER_MSB(per_id) | ATC_SRC_PER(per_id);
1333 /*
1334 * We have to translate the value we get from the device tree since
1335 * the half FIFO configuration value had to be 0 to keep backward
1336 * compatibility.
1337 */
1338 switch (dma_spec->args[1] & AT91_DMA_CFG_FIFOCFG_MASK) {
1339 case AT91_DMA_CFG_FIFOCFG_ALAP:
1340 atslave->cfg |= ATC_FIFOCFG_LARGESTBURST;
1341 break;
1342 case AT91_DMA_CFG_FIFOCFG_ASAP:
1343 atslave->cfg |= ATC_FIFOCFG_ENOUGHSPACE;
1344 break;
1345 case AT91_DMA_CFG_FIFOCFG_HALF:
1346 default:
1347 atslave->cfg |= ATC_FIFOCFG_HALFFIFO;
1348 }
1332 atslave->dma_dev = &dmac_pdev->dev; 1349 atslave->dma_dev = &dmac_pdev->dev;
1333 1350
1334 chan = dma_request_channel(mask, at_dma_filter, atslave); 1351 chan = dma_request_channel(mask, at_dma_filter, atslave);