aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/imx-dma.c
diff options
context:
space:
mode:
authorJavier Martin <javier.martin@vista-silicon.com>2012-03-22 09:54:04 -0400
committerVinod Koul <vinod.koul@linux.intel.com>2012-03-26 02:01:30 -0400
commit3b4b6dfc202dc5bedb03f2fae4ccc3f5b95dd563 (patch)
treedf376a0f96d4257ab55db8aaae733dcf259e9ff3 /drivers/dma/imx-dma.c
parent2efc3449d7b11f36f532180cb738364fd2c28e03 (diff)
dmaengine: imx-dma: remove 'imxdma_setup_mem2mem_hw' function.
This function is only used once in the driver and has a lot of checks that are not needed anymore. For this reason it's been merged with 'imxdma_enable_hw'. Signed-off-by: Javier Martin <javier.martin@vista-silicon.com> Acked-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
Diffstat (limited to 'drivers/dma/imx-dma.c')
-rw-r--r--drivers/dma/imx-dma.c57
1 files changed, 14 insertions, 43 deletions
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
index 04a2c1446dc2..dcb2c70aec7a 100644
--- a/drivers/dma/imx-dma.c
+++ b/drivers/dma/imx-dma.c
@@ -260,41 +260,6 @@ static inline int imxdma_sg_next(struct imxdma_desc *d, struct scatterlist *sg)
260 return now; 260 return now;
261} 261}
262 262
263static int
264imxdma_setup_mem2mem_hw(struct imxdma_channel *imxdmac, dma_addr_t dma_address,
265 unsigned int dma_length, unsigned int dev_addr)
266{
267 int channel = imxdmac->channel;
268
269 imxdmac->internal.sg = NULL;
270
271 if (!dma_address) {
272 printk(KERN_ERR "imxdma%d: imx_dma_setup_single null address\n",
273 channel);
274 return -EINVAL;
275 }
276
277 if (!dma_length) {
278 printk(KERN_ERR "imxdma%d: imx_dma_setup_single zero length\n",
279 channel);
280 return -EINVAL;
281 }
282
283 pr_debug("imxdma%d: %s dma_addressg=0x%08x dma_length=%d "
284 "dev_addr=0x%08x for write\n",
285 channel, __func__, (unsigned int)dma_address,
286 dma_length, dev_addr);
287
288 imx_dmav1_writel(dma_address, DMA_SAR(channel));
289 imx_dmav1_writel(dev_addr, DMA_DAR(channel));
290 imx_dmav1_writel(imxdmac->internal.ccr_to_device,
291 DMA_CCR(channel));
292
293 imx_dmav1_writel(dma_length, DMA_CNTR(channel));
294
295 return 0;
296}
297
298static void imxdma_enable_hw(struct imxdma_desc *d) 263static void imxdma_enable_hw(struct imxdma_desc *d)
299{ 264{
300 struct imxdma_channel *imxdmac = to_imxdma_chan(d->desc.chan); 265 struct imxdma_channel *imxdmac = to_imxdma_chan(d->desc.chan);
@@ -586,20 +551,26 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id)
586static int imxdma_xfer_desc(struct imxdma_desc *d) 551static int imxdma_xfer_desc(struct imxdma_desc *d)
587{ 552{
588 struct imxdma_channel *imxdmac = to_imxdma_chan(d->desc.chan); 553 struct imxdma_channel *imxdmac = to_imxdma_chan(d->desc.chan);
554 struct imxdma_engine *imxdma = imxdmac->imxdma;
589 int ret; 555 int ret;
590 556
591 /* Configure and enable */ 557 /* Configure and enable */
592 switch (d->type) { 558 switch (d->type) {
593 case IMXDMA_DESC_MEMCPY: 559 case IMXDMA_DESC_MEMCPY:
594 ret = imxdma_config_channel_hw(imxdmac, 560 imxdmac->internal.sg = NULL;
595 d->config_port, d->config_mem, 0, 0); 561
596 if (ret < 0) 562 imx_dmav1_writel(d->src, DMA_SAR(imxdmac->channel));
597 return ret; 563 imx_dmav1_writel(d->dest, DMA_DAR(imxdmac->channel));
598 ret = imxdma_setup_mem2mem_hw(imxdmac, d->src, d->len, d->dest); 564 imx_dmav1_writel(d->config_mem | (d->config_port << 2),
599 if (ret < 0) 565 DMA_CCR(imxdmac->channel));
600 return ret;
601 break;
602 566
567 imx_dmav1_writel(d->len, DMA_CNTR(imxdmac->channel));
568
569 dev_dbg(imxdma->dev, "%s channel: %d dest=0x%08x src=0x%08x "
570 "dma_length=%d\n", __func__, imxdmac->channel,
571 d->dest, d->src, d->len);
572
573 break;
603 /* Cyclic transfer is the same as slave_sg with special sg configuration. */ 574 /* Cyclic transfer is the same as slave_sg with special sg configuration. */
604 case IMXDMA_DESC_CYCLIC: 575 case IMXDMA_DESC_CYCLIC:
605 case IMXDMA_DESC_SLAVE_SG: 576 case IMXDMA_DESC_SLAVE_SG: