diff options
-rw-r--r-- | drivers/dma/imx-dma.c | 46 |
1 files changed, 13 insertions, 33 deletions
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index dcb2c70aec7a..25b4108f6224 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c | |||
@@ -314,32 +314,6 @@ static void imxdma_disable_hw(struct imxdma_channel *imxdmac) | |||
314 | } | 314 | } |
315 | 315 | ||
316 | static int | 316 | static int |
317 | imxdma_config_channel_hw(struct imxdma_channel *imxdmac, unsigned int config_port, | ||
318 | unsigned int config_mem, unsigned int dmareq, int hw_chaining) | ||
319 | { | ||
320 | int channel = imxdmac->channel; | ||
321 | u32 dreq = 0; | ||
322 | |||
323 | imxdmac->internal.hw_chaining = 0; | ||
324 | |||
325 | if (hw_chaining) { | ||
326 | imxdmac->internal.hw_chaining = 1; | ||
327 | if (!imxdma_hw_chain(&imxdmac->internal)) | ||
328 | return -EINVAL; | ||
329 | } | ||
330 | |||
331 | if (dmareq) | ||
332 | dreq = CCR_REN; | ||
333 | |||
334 | imxdmac->internal.ccr_from_device = config_port | (config_mem << 2) | dreq; | ||
335 | imxdmac->internal.ccr_to_device = config_mem | (config_port << 2) | dreq; | ||
336 | |||
337 | imx_dmav1_writel(dmareq, DMA_RSSR(channel)); | ||
338 | |||
339 | return 0; | ||
340 | } | ||
341 | |||
342 | static int | ||
343 | imxdma_setup_sg_hw(struct imxdma_desc *d, | 317 | imxdma_setup_sg_hw(struct imxdma_desc *d, |
344 | struct scatterlist *sg, unsigned int sgcount, | 318 | struct scatterlist *sg, unsigned int sgcount, |
345 | unsigned int dma_length, unsigned int dev_addr, | 319 | unsigned int dma_length, unsigned int dev_addr, |
@@ -628,7 +602,6 @@ static int imxdma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, | |||
628 | { | 602 | { |
629 | struct imxdma_channel *imxdmac = to_imxdma_chan(chan); | 603 | struct imxdma_channel *imxdmac = to_imxdma_chan(chan); |
630 | struct dma_slave_config *dmaengine_cfg = (void *)arg; | 604 | struct dma_slave_config *dmaengine_cfg = (void *)arg; |
631 | int ret; | ||
632 | unsigned long flags; | 605 | unsigned long flags; |
633 | unsigned int mode = 0; | 606 | unsigned int mode = 0; |
634 | 607 | ||
@@ -664,13 +637,20 @@ static int imxdma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, | |||
664 | mode = IMX_DMA_MEMSIZE_32; | 637 | mode = IMX_DMA_MEMSIZE_32; |
665 | break; | 638 | break; |
666 | } | 639 | } |
667 | ret = imxdma_config_channel_hw(imxdmac, | ||
668 | mode | IMX_DMA_TYPE_FIFO, | ||
669 | IMX_DMA_MEMSIZE_32 | IMX_DMA_TYPE_LINEAR, | ||
670 | imxdmac->dma_request, 1); | ||
671 | 640 | ||
672 | if (ret) | 641 | imxdmac->internal.hw_chaining = 1; |
673 | return ret; | 642 | if (!imxdma_hw_chain(&imxdmac->internal)) |
643 | return -EINVAL; | ||
644 | imxdmac->internal.ccr_from_device = | ||
645 | (mode | IMX_DMA_TYPE_FIFO) | | ||
646 | ((IMX_DMA_MEMSIZE_32 | IMX_DMA_TYPE_LINEAR) << 2) | | ||
647 | CCR_REN; | ||
648 | imxdmac->internal.ccr_to_device = | ||
649 | (IMX_DMA_MEMSIZE_32 | IMX_DMA_TYPE_LINEAR) | | ||
650 | ((mode | IMX_DMA_TYPE_FIFO) << 2) | CCR_REN; | ||
651 | imx_dmav1_writel(imxdmac->dma_request, | ||
652 | DMA_RSSR(imxdmac->channel)); | ||
653 | |||
674 | /* Set burst length */ | 654 | /* Set burst length */ |
675 | imx_dmav1_writel(imxdmac->watermark_level * imxdmac->word_size, | 655 | imx_dmav1_writel(imxdmac->watermark_level * imxdmac->word_size, |
676 | DMA_BLR(imxdmac->channel)); | 656 | DMA_BLR(imxdmac->channel)); |