aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinod Koul <vinod.koul@intel.com>2014-10-15 12:09:09 -0400
committerVinod Koul <vinod.koul@intel.com>2014-10-15 12:09:09 -0400
commitcf6c0ab54daeb614ae79bdd0168e8b7ec2650134 (patch)
treea5dbdf23ae9184edce0cab7944df9798da309a1d
parent2856fcdc1f7b6dc237afc2dbec6fbd21fe88dd4e (diff)
parentb80719b6bd083130c112cb4d3e5329a164eef4c3 (diff)
Merge branch 'topic/dma_control_fsl_acks' into for-linus
-rw-r--r--drivers/dma/fsldma.c25
-rw-r--r--drivers/misc/carma/carma-fpga-program.c12
-rw-r--r--include/linux/dmaengine.h13
-rw-r--r--include/linux/fsldma.h13
4 files changed, 44 insertions, 19 deletions
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index d5d6885ab341..994bcb2c6b92 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -36,7 +36,7 @@
36#include <linux/of_address.h> 36#include <linux/of_address.h>
37#include <linux/of_irq.h> 37#include <linux/of_irq.h>
38#include <linux/of_platform.h> 38#include <linux/of_platform.h>
39 39#include <linux/fsldma.h>
40#include "dmaengine.h" 40#include "dmaengine.h"
41#include "fsldma.h" 41#include "fsldma.h"
42 42
@@ -367,6 +367,20 @@ static void fsl_chan_toggle_ext_start(struct fsldma_chan *chan, int enable)
367 chan->feature &= ~FSL_DMA_CHAN_START_EXT; 367 chan->feature &= ~FSL_DMA_CHAN_START_EXT;
368} 368}
369 369
370int fsl_dma_external_start(struct dma_chan *dchan, int enable)
371{
372 struct fsldma_chan *chan;
373
374 if (!dchan)
375 return -EINVAL;
376
377 chan = to_fsl_chan(dchan);
378
379 fsl_chan_toggle_ext_start(chan, enable);
380 return 0;
381}
382EXPORT_SYMBOL_GPL(fsl_dma_external_start);
383
370static void append_ld_queue(struct fsldma_chan *chan, struct fsl_desc_sw *desc) 384static void append_ld_queue(struct fsldma_chan *chan, struct fsl_desc_sw *desc)
371{ 385{
372 struct fsl_desc_sw *tail = to_fsl_desc(chan->ld_pending.prev); 386 struct fsl_desc_sw *tail = to_fsl_desc(chan->ld_pending.prev);
@@ -998,15 +1012,6 @@ static int fsl_dma_device_control(struct dma_chan *dchan,
998 chan->set_request_count(chan, size); 1012 chan->set_request_count(chan, size);
999 return 0; 1013 return 0;
1000 1014
1001 case FSLDMA_EXTERNAL_START:
1002
1003 /* make sure the channel supports external start */
1004 if (!chan->toggle_ext_start)
1005 return -ENXIO;
1006
1007 chan->toggle_ext_start(chan, arg);
1008 return 0;
1009
1010 default: 1015 default:
1011 return -ENXIO; 1016 return -ENXIO;
1012 } 1017 }
diff --git a/drivers/misc/carma/carma-fpga-program.c b/drivers/misc/carma/carma-fpga-program.c
index 7be89832db19..298f9127e697 100644
--- a/drivers/misc/carma/carma-fpga-program.c
+++ b/drivers/misc/carma/carma-fpga-program.c
@@ -16,6 +16,7 @@
16#include <linux/completion.h> 16#include <linux/completion.h>
17#include <linux/miscdevice.h> 17#include <linux/miscdevice.h>
18#include <linux/dmaengine.h> 18#include <linux/dmaengine.h>
19#include <linux/fsldma.h>
19#include <linux/interrupt.h> 20#include <linux/interrupt.h>
20#include <linux/highmem.h> 21#include <linux/highmem.h>
21#include <linux/kernel.h> 22#include <linux/kernel.h>
@@ -518,23 +519,22 @@ static noinline int fpga_program_dma(struct fpga_dev *priv)
518 config.direction = DMA_MEM_TO_DEV; 519 config.direction = DMA_MEM_TO_DEV;
519 config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; 520 config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
520 config.dst_maxburst = fpga_fifo_size(priv->regs) / 2 / 4; 521 config.dst_maxburst = fpga_fifo_size(priv->regs) / 2 / 4;
521 ret = chan->device->device_control(chan, DMA_SLAVE_CONFIG, 522 ret = dmaengine_slave_config(chan, &config);
522 (unsigned long)&config);
523 if (ret) { 523 if (ret) {
524 dev_err(priv->dev, "DMA slave configuration failed\n"); 524 dev_err(priv->dev, "DMA slave configuration failed\n");
525 goto out_dma_unmap; 525 goto out_dma_unmap;
526 } 526 }
527 527
528 ret = chan->device->device_control(chan, FSLDMA_EXTERNAL_START, 1); 528 ret = fsl_dma_external_start(chan, 1)
529 if (ret) { 529 if (ret) {
530 dev_err(priv->dev, "DMA external control setup failed\n"); 530 dev_err(priv->dev, "DMA external control setup failed\n");
531 goto out_dma_unmap; 531 goto out_dma_unmap;
532 } 532 }
533 533
534 /* setup and submit the DMA transaction */ 534 /* setup and submit the DMA transaction */
535 tx = chan->device->device_prep_dma_sg(chan, 535
536 table.sgl, num_pages, 536 tx = dmaengine_prep_dma_sg(chan, table.sgl, num_pages,
537 vb->sglist, vb->sglen, 0); 537 vb->sglist, vb->sglen, 0);
538 if (!tx) { 538 if (!tx) {
539 dev_err(priv->dev, "Unable to prep DMA transaction\n"); 539 dev_err(priv->dev, "Unable to prep DMA transaction\n");
540 ret = -ENOMEM; 540 ret = -ENOMEM;
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 3d291f59acd8..3254a039b0e0 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -199,15 +199,12 @@ enum dma_ctrl_flags {
199 * configuration data in statically from the platform). An additional 199 * configuration data in statically from the platform). An additional
200 * argument of struct dma_slave_config must be passed in with this 200 * argument of struct dma_slave_config must be passed in with this
201 * command. 201 * command.
202 * @FSLDMA_EXTERNAL_START: this command will put the Freescale DMA controller
203 * into external start mode.
204 */ 202 */
205enum dma_ctrl_cmd { 203enum dma_ctrl_cmd {
206 DMA_TERMINATE_ALL, 204 DMA_TERMINATE_ALL,
207 DMA_PAUSE, 205 DMA_PAUSE,
208 DMA_RESUME, 206 DMA_RESUME,
209 DMA_SLAVE_CONFIG, 207 DMA_SLAVE_CONFIG,
210 FSLDMA_EXTERNAL_START,
211}; 208};
212 209
213/** 210/**
@@ -757,6 +754,16 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_interleaved_dma(
757 return chan->device->device_prep_interleaved_dma(chan, xt, flags); 754 return chan->device->device_prep_interleaved_dma(chan, xt, flags);
758} 755}
759 756
757static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_sg(
758 struct dma_chan *chan,
759 struct scatterlist *dst_sg, unsigned int dst_nents,
760 struct scatterlist *src_sg, unsigned int src_nents,
761 unsigned long flags)
762{
763 return chan->device->device_prep_dma_sg(chan, dst_sg, dst_nents,
764 src_sg, src_nents, flags);
765}
766
760static inline int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps) 767static inline int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps)
761{ 768{
762 if (!chan || !caps) 769 if (!chan || !caps)
diff --git a/include/linux/fsldma.h b/include/linux/fsldma.h
new file mode 100644
index 000000000000..b213c02963c9
--- /dev/null
+++ b/include/linux/fsldma.h
@@ -0,0 +1,13 @@
1/*
2 * This is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 */
7
8#ifndef FSL_DMA_H
9#define FSL_DMA_H
10/* fsl dma API for enxternal start */
11int fsl_dma_external_start(struct dma_chan *dchan, int enable);
12
13#endif