Merge branch 'next' of git://git.infradead.org/users/vkoul/slave-dma
[linux-2.6-block.git] / drivers / dma / tegra20-apb-dma.c
index c71812f8d9c17d42c140b456c723ea687a032c4a..fcee27eae1f6d35d9635a009e3fe991fc87a0eeb 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/delay.h>
 #include <linux/dmaengine.h>
 #include <linux/dma-mapping.h>
+#include <linux/err.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
@@ -31,8 +32,8 @@
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/slab.h>
+#include <linux/clk/tegra.h>
 
-#include <mach/clk.h>
 #include "dmaengine.h"
 
 #define TEGRA_APBDMA_GENERAL                   0x0
@@ -271,6 +272,7 @@ static struct tegra_dma_desc *tegra_dma_desc_get(
                if (async_tx_test_ack(&dma_desc->txd)) {
                        list_del(&dma_desc->node);
                        spin_unlock_irqrestore(&tdc->lock, flags);
+                       dma_desc->txd.flags = 0;
                        return dma_desc;
                }
        }
@@ -1080,7 +1082,9 @@ struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic(
                                        TEGRA_APBDMA_AHBSEQ_WRAP_SHIFT;
        ahb_seq |= TEGRA_APBDMA_AHBSEQ_BUS_WIDTH_32;
 
-       csr |= TEGRA_APBDMA_CSR_FLOW | TEGRA_APBDMA_CSR_IE_EOC;
+       csr |= TEGRA_APBDMA_CSR_FLOW;
+       if (flags & DMA_PREP_INTERRUPT)
+               csr |= TEGRA_APBDMA_CSR_IE_EOC;
        csr |= tdc->dma_sconfig.slave_id << TEGRA_APBDMA_CSR_REQ_SEL_SHIFT;
 
        apb_seq |= TEGRA_APBDMA_APBSEQ_WRAP_WORD_1;
@@ -1125,7 +1129,8 @@ struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic(
                mem += len;
        }
        sg_req->last_sg = true;
-       dma_desc->txd.flags = 0;
+       if (flags & DMA_CTRL_ACK)
+               dma_desc->txd.flags = DMA_CTRL_ACK;
 
        /*
         * Make sure that mode should not be conflicting with currently
@@ -1279,12 +1284,9 @@ static int tegra_dma_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
-       tdma->base_addr = devm_request_and_ioremap(&pdev->dev, res);
-       if (!tdma->base_addr) {
-               dev_err(&pdev->dev,
-                       "Cannot request memregion/iomap dma address\n");
-               return -EADDRNOTAVAIL;
-       }
+       tdma->base_addr = devm_ioremap_resource(&pdev->dev, res);
+       if (IS_ERR(tdma->base_addr))
+               return PTR_ERR(tdma->base_addr);
 
        tdma->dma_clk = devm_clk_get(&pdev->dev, NULL);
        if (IS_ERR(tdma->dma_clk)) {
@@ -1403,7 +1405,7 @@ err_pm_disable:
        return ret;
 }
 
-static int __devexit tegra_dma_remove(struct platform_device *pdev)
+static int tegra_dma_remove(struct platform_device *pdev)
 {
        struct tegra_dma *tdma = platform_get_drvdata(pdev);
        int i;
@@ -1446,7 +1448,7 @@ static int tegra_dma_runtime_resume(struct device *dev)
        return 0;
 }
 
-static const struct dev_pm_ops tegra_dma_dev_pm_ops __devinitconst = {
+static const struct dev_pm_ops tegra_dma_dev_pm_ops = {
 #ifdef CONFIG_PM_RUNTIME
        .runtime_suspend = tegra_dma_runtime_suspend,
        .runtime_resume = tegra_dma_runtime_resume,