]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge branch 'for-4.3-fixes' into for-next
authorTejun Heo <tj@kernel.org>
Thu, 17 Sep 2015 15:14:46 +0000 (11:14 -0400)
committerTejun Heo <tj@kernel.org>
Thu, 17 Sep 2015 15:14:46 +0000 (11:14 -0400)
Documentation/devicetree/bindings/ata/ahci-fsl-qoriq.txt [new file with mode: 0644]
Documentation/devicetree/bindings/ata/ahci-platform.txt
drivers/ata/Kconfig
drivers/ata/Makefile
drivers/ata/ahci_platform.c
drivers/ata/ahci_qoriq.c [new file with mode: 0644]
drivers/ata/pata_pxa.c

diff --git a/Documentation/devicetree/bindings/ata/ahci-fsl-qoriq.txt b/Documentation/devicetree/bindings/ata/ahci-fsl-qoriq.txt
new file mode 100644 (file)
index 0000000..b614e3b
--- /dev/null
@@ -0,0 +1,21 @@
+Binding for Freescale QorIQ AHCI SATA Controller
+
+Required properties:
+  - reg: Physical base address and size of the controller's register area.
+  - compatible: Compatibility string. Must be 'fsl,<chip>-ahci', where
+    chip could be ls1021a, ls2085a, ls1043a etc.
+  - clocks: Input clock specifier. Refer to common clock bindings.
+  - interrupts: Interrupt specifier. Refer to interrupt binding.
+
+Optional properties:
+  - dma-coherent: Enable ACHI coherency DMA operation.
+  - reg-names: register area names when there are more then 1 regster area.
+
+Examples:
+       sata@3200000 {
+               compatible = "fsl,ls1021a-ahci";
+               reg = <0x0 0x3200000 0x0 0x10000>;
+               interrupts = <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&platform_clk 1>;
+               dma-coherent;
+       };
index a2321819e7f5fb1613fa8c4ef3b092e87fe4e647..c2340eeeb97ff072196dbcd49144897813b1573d 100644 (file)
@@ -16,8 +16,6 @@ Required properties:
   - "snps,dwc-ahci"
   - "snps,exynos5440-ahci"
   - "snps,spear-ahci"
-  - "fsl,qoriq-ahci" : for qoriq series socs which include ls1021, ls2085, etc.
-  - "fsl,<chip>-ahci" : chip could be ls1021, ls2085 etc.
   - "generic-ahci"
 - interrupts        : <interrupt mapping for SATA IRQ>
 - reg               : <registers mapping>
index 15e40ee62a94e0c0ce20b07c7d4ff1ce03f78f6b..6aaa3f81755be2e4917decb14c8f52348efeb0d0 100644 (file)
@@ -175,6 +175,15 @@ config AHCI_XGENE
        help
         This option enables support for APM X-Gene SoC SATA host controller.
 
+config AHCI_QORIQ
+       tristate "Freescale QorIQ AHCI SATA support"
+       depends on OF
+       help
+         This option enables support for the Freescale QorIQ AHCI SoC's
+         onboard AHCI SATA.
+
+         If unsure, say N.
+
 config SATA_FSL
        tristate "Freescale 3.0Gbps SATA support"
        depends on FSL_SOC
index af70919f7ddef6cc0c3e52763a843ada5c6656ac..af45effac18c144f569080b944b595eaaae78fea 100644 (file)
@@ -19,6 +19,7 @@ obj-$(CONFIG_AHCI_SUNXI)      += ahci_sunxi.o libahci.o libahci_platform.o
 obj-$(CONFIG_AHCI_ST)          += ahci_st.o libahci.o libahci_platform.o
 obj-$(CONFIG_AHCI_TEGRA)       += ahci_tegra.o libahci.o libahci_platform.o
 obj-$(CONFIG_AHCI_XGENE)       += ahci_xgene.o libahci.o libahci_platform.o
+obj-$(CONFIG_AHCI_QORIQ)       += ahci_qoriq.o libahci.o libahci_platform.o
 
 # SFF w/ custom DMA
 obj-$(CONFIG_PDC_ADMA)         += pdc_adma.o
index 1befb114c3844c507939fe82924d60340edce15b..04975b851c237c4894282f94feed4ad19a1c9b01 100644 (file)
@@ -76,7 +76,6 @@ static const struct of_device_id ahci_of_match[] = {
        { .compatible = "ibm,476gtr-ahci", },
        { .compatible = "snps,dwc-ahci", },
        { .compatible = "hisilicon,hisi-ahci", },
-       { .compatible = "fsl,qoriq-ahci", },
        {},
 };
 MODULE_DEVICE_TABLE(of, ahci_of_match);
diff --git a/drivers/ata/ahci_qoriq.c b/drivers/ata/ahci_qoriq.c
new file mode 100644 (file)
index 0000000..e5e4988
--- /dev/null
@@ -0,0 +1,272 @@
+/*
+ * Freescale QorIQ AHCI SATA platform driver
+ *
+ * Copyright 2015 Freescale, Inc.
+ *   Tang Yuantian <Yuantian.Tang@freescale.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/pm.h>
+#include <linux/ahci_platform.h>
+#include <linux/device.h>
+#include <linux/of_address.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
+#include <linux/libata.h>
+#include "ahci.h"
+
+#define DRV_NAME "ahci-qoriq"
+
+/* port register definition */
+#define PORT_PHY1      0xA8
+#define PORT_PHY2      0xAC
+#define PORT_PHY3      0xB0
+#define PORT_PHY4      0xB4
+#define PORT_PHY5      0xB8
+#define PORT_TRANS     0xC8
+
+/* port register default value */
+#define AHCI_PORT_PHY_1_CFG    0xa003fffe
+#define AHCI_PORT_PHY_2_CFG    0x28183411
+#define AHCI_PORT_PHY_3_CFG    0x0e081004
+#define AHCI_PORT_PHY_4_CFG    0x00480811
+#define AHCI_PORT_PHY_5_CFG    0x192c96a4
+#define AHCI_PORT_TRANS_CFG    0x08000025
+
+#define SATA_ECC_DISABLE       0x00020000
+
+enum ahci_qoriq_type {
+       AHCI_LS1021A,
+       AHCI_LS1043A,
+       AHCI_LS2085A,
+};
+
+struct ahci_qoriq_priv {
+       struct ccsr_ahci *reg_base;
+       enum ahci_qoriq_type type;
+       void __iomem *ecc_addr;
+};
+
+static const struct of_device_id ahci_qoriq_of_match[] = {
+       { .compatible = "fsl,ls1021a-ahci", .data = (void *)AHCI_LS1021A},
+       { .compatible = "fsl,ls1043a-ahci", .data = (void *)AHCI_LS1043A},
+       { .compatible = "fsl,ls2085a-ahci", .data = (void *)AHCI_LS2085A},
+       {},
+};
+MODULE_DEVICE_TABLE(of, ahci_qoriq_of_match);
+
+static int ahci_qoriq_hardreset(struct ata_link *link, unsigned int *class,
+                         unsigned long deadline)
+{
+       const unsigned long *timing = sata_ehc_deb_timing(&link->eh_context);
+       void __iomem *port_mmio = ahci_port_base(link->ap);
+       u32 px_cmd, px_is, px_val;
+       struct ata_port *ap = link->ap;
+       struct ahci_port_priv *pp = ap->private_data;
+       struct ahci_host_priv *hpriv = ap->host->private_data;
+       struct ahci_qoriq_priv *qoriq_priv = hpriv->plat_data;
+       u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG;
+       struct ata_taskfile tf;
+       bool online;
+       int rc;
+
+       DPRINTK("ENTER\n");
+
+       ahci_stop_engine(ap);
+
+       /*
+        * There is a errata on ls1021a Rev1.0 and Rev2.0 which is:
+        * A-009042: The device detection initialization sequence
+        * mistakenly resets some registers.
+        *
+        * Workaround for this is:
+        * The software should read and store PxCMD and PxIS values
+        * before issuing the device detection initialization sequence.
+        * After the sequence is complete, software should restore the
+        * PxCMD and PxIS with the stored values.
+        */
+       if (qoriq_priv->type == AHCI_LS1021A) {
+               px_cmd = readl(port_mmio + PORT_CMD);
+               px_is = readl(port_mmio + PORT_IRQ_STAT);
+       }
+
+       /* clear D2H reception area to properly wait for D2H FIS */
+       ata_tf_init(link->device, &tf);
+       tf.command = ATA_BUSY;
+       ata_tf_to_fis(&tf, 0, 0, d2h_fis);
+
+       rc = sata_link_hardreset(link, timing, deadline, &online,
+                                ahci_check_ready);
+
+       /* restore the PxCMD and PxIS on ls1021 */
+       if (qoriq_priv->type == AHCI_LS1021A) {
+               px_val = readl(port_mmio + PORT_CMD);
+               if (px_val != px_cmd)
+                       writel(px_cmd, port_mmio + PORT_CMD);
+
+               px_val = readl(port_mmio + PORT_IRQ_STAT);
+               if (px_val != px_is)
+                       writel(px_is, port_mmio + PORT_IRQ_STAT);
+       }
+
+       hpriv->start_engine(ap);
+
+       if (online)
+               *class = ahci_dev_classify(ap);
+
+       DPRINTK("EXIT, rc=%d, class=%u\n", rc, *class);
+       return rc;
+}
+
+static struct ata_port_operations ahci_qoriq_ops = {
+       .inherits       = &ahci_ops,
+       .hardreset      = ahci_qoriq_hardreset,
+};
+
+static const struct ata_port_info ahci_qoriq_port_info = {
+       .flags          = AHCI_FLAG_COMMON | ATA_FLAG_NCQ,
+       .pio_mask       = ATA_PIO4,
+       .udma_mask      = ATA_UDMA6,
+       .port_ops       = &ahci_qoriq_ops,
+};
+
+static struct scsi_host_template ahci_qoriq_sht = {
+       AHCI_SHT(DRV_NAME),
+};
+
+static int ahci_qoriq_phy_init(struct ahci_host_priv *hpriv)
+{
+       struct ahci_qoriq_priv *qpriv = hpriv->plat_data;
+       void __iomem *reg_base = hpriv->mmio;
+
+       switch (qpriv->type) {
+       case AHCI_LS1021A:
+               writel(SATA_ECC_DISABLE, qpriv->ecc_addr);
+               writel(AHCI_PORT_PHY_1_CFG, reg_base + PORT_PHY1);
+               writel(AHCI_PORT_PHY_2_CFG, reg_base + PORT_PHY2);
+               writel(AHCI_PORT_PHY_3_CFG, reg_base + PORT_PHY3);
+               writel(AHCI_PORT_PHY_4_CFG, reg_base + PORT_PHY4);
+               writel(AHCI_PORT_PHY_5_CFG, reg_base + PORT_PHY5);
+               writel(AHCI_PORT_TRANS_CFG, reg_base + PORT_TRANS);
+               break;
+
+       case AHCI_LS1043A:
+       case AHCI_LS2085A:
+               writel(AHCI_PORT_PHY_1_CFG, reg_base + PORT_PHY1);
+               break;
+       }
+
+       return 0;
+}
+
+static int ahci_qoriq_probe(struct platform_device *pdev)
+{
+       struct device_node *np = pdev->dev.of_node;
+       struct device *dev = &pdev->dev;
+       struct ahci_host_priv *hpriv;
+       struct ahci_qoriq_priv *qoriq_priv;
+       const struct of_device_id *of_id;
+       struct resource *res;
+       int rc;
+
+       hpriv = ahci_platform_get_resources(pdev);
+       if (IS_ERR(hpriv))
+               return PTR_ERR(hpriv);
+
+       of_id = of_match_node(ahci_qoriq_of_match, np);
+       if (!of_id)
+               return -ENODEV;
+
+       qoriq_priv = devm_kzalloc(dev, sizeof(*qoriq_priv), GFP_KERNEL);
+       if (!qoriq_priv)
+               return -ENOMEM;
+
+       qoriq_priv->type = (enum ahci_qoriq_type)of_id->data;
+
+       if (qoriq_priv->type == AHCI_LS1021A) {
+               res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+                               "sata-ecc");
+               qoriq_priv->ecc_addr = devm_ioremap_resource(dev, res);
+               if (IS_ERR(qoriq_priv->ecc_addr))
+                       return PTR_ERR(qoriq_priv->ecc_addr);
+       }
+
+       rc = ahci_platform_enable_resources(hpriv);
+       if (rc)
+               return rc;
+
+       hpriv->plat_data = qoriq_priv;
+       rc = ahci_qoriq_phy_init(hpriv);
+       if (rc)
+               goto disable_resources;
+
+       rc = ahci_platform_init_host(pdev, hpriv, &ahci_qoriq_port_info,
+                                    &ahci_qoriq_sht);
+       if (rc)
+               goto disable_resources;
+
+       return 0;
+
+disable_resources:
+       ahci_platform_disable_resources(hpriv);
+
+       return rc;
+}
+
+#ifdef CONFIG_PM_SLEEP
+static int ahci_qoriq_resume(struct device *dev)
+{
+       struct ata_host *host = dev_get_drvdata(dev);
+       struct ahci_host_priv *hpriv = host->private_data;
+       int rc;
+
+       rc = ahci_platform_enable_resources(hpriv);
+       if (rc)
+               return rc;
+
+       rc = ahci_qoriq_phy_init(hpriv);
+       if (rc)
+               goto disable_resources;
+
+       rc = ahci_platform_resume_host(dev);
+       if (rc)
+               goto disable_resources;
+
+       /* We resumed so update PM runtime state */
+       pm_runtime_disable(dev);
+       pm_runtime_set_active(dev);
+       pm_runtime_enable(dev);
+
+       return 0;
+
+disable_resources:
+       ahci_platform_disable_resources(hpriv);
+
+       return rc;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(ahci_qoriq_pm_ops, ahci_platform_suspend,
+                        ahci_qoriq_resume);
+
+static struct platform_driver ahci_qoriq_driver = {
+       .probe = ahci_qoriq_probe,
+       .remove = ata_platform_remove_one,
+       .driver = {
+               .name = DRV_NAME,
+               .of_match_table = ahci_qoriq_of_match,
+               .pm = &ahci_qoriq_pm_ops,
+       },
+};
+module_platform_driver(ahci_qoriq_driver);
+
+MODULE_DESCRIPTION("Freescale QorIQ AHCI SATA platform driver");
+MODULE_AUTHOR("Tang Yuantian <Yuantian.Tang@freescale.com>");
+MODULE_LICENSE("GPL");
index c36b3e6531d89f482a73299ea28c54b7da13a668..f6c46e9a4dc0f1425ae99b7fbf5dfa71d6a86eeb 100644 (file)
 #include <linux/ata.h>
 #include <linux/libata.h>
 #include <linux/platform_device.h>
+#include <linux/dmaengine.h>
+#include <linux/dma/pxa-dma.h>
 #include <linux/gpio.h>
 #include <linux/slab.h>
 #include <linux/completion.h>
 
 #include <scsi/scsi_host.h>
 
-#include <mach/pxa2xx-regs.h>
 #include <linux/platform_data/ata-pxa.h>
-#include <mach/dma.h>
 
 #define DRV_NAME       "pata_pxa"
 #define DRV_VERSION    "0.1"
 
 struct pata_pxa_data {
-       uint32_t                dma_channel;
-       struct pxa_dma_desc     *dma_desc;
-       dma_addr_t              dma_desc_addr;
-       uint32_t                dma_desc_id;
-
-       /* DMA IO physical address */
-       uint32_t                dma_io_addr;
-       /* PXA DREQ<0:2> pin selector */
-       uint32_t                dma_dreq;
-       /* DMA DCSR register value */
-       uint32_t                dma_dcsr;
-
+       struct dma_chan         *dma_chan;
+       dma_cookie_t            dma_cookie;
        struct completion       dma_done;
 };
 
 /*
- * Setup the DMA descriptors. The size is transfer capped at 4k per descriptor,
- * if the transfer is longer, it is split into multiple chained descriptors.
+ * DMA interrupt handler.
  */
-static void pxa_load_dmac(struct scatterlist *sg, struct ata_queued_cmd *qc)
+static void pxa_ata_dma_irq(void *d)
 {
-       struct pata_pxa_data *pd = qc->ap->private_data;
-
-       uint32_t cpu_len, seg_len;
-       dma_addr_t cpu_addr;
-
-       cpu_addr = sg_dma_address(sg);
-       cpu_len = sg_dma_len(sg);
-
-       do {
-               seg_len = (cpu_len > 0x1000) ? 0x1000 : cpu_len;
-
-               pd->dma_desc[pd->dma_desc_id].ddadr = pd->dma_desc_addr +
-                       ((pd->dma_desc_id + 1) * sizeof(struct pxa_dma_desc));
-
-               pd->dma_desc[pd->dma_desc_id].dcmd = DCMD_BURST32 |
-                                       DCMD_WIDTH2 | (DCMD_LENGTH & seg_len);
-
-               if (qc->tf.flags & ATA_TFLAG_WRITE) {
-                       pd->dma_desc[pd->dma_desc_id].dsadr = cpu_addr;
-                       pd->dma_desc[pd->dma_desc_id].dtadr = pd->dma_io_addr;
-                       pd->dma_desc[pd->dma_desc_id].dcmd |= DCMD_INCSRCADDR |
-                                               DCMD_FLOWTRG;
-               } else {
-                       pd->dma_desc[pd->dma_desc_id].dsadr = pd->dma_io_addr;
-                       pd->dma_desc[pd->dma_desc_id].dtadr = cpu_addr;
-                       pd->dma_desc[pd->dma_desc_id].dcmd |= DCMD_INCTRGADDR |
-                                               DCMD_FLOWSRC;
-               }
-
-               cpu_len -= seg_len;
-               cpu_addr += seg_len;
-               pd->dma_desc_id++;
+       struct pata_pxa_data *pd = d;
+       enum dma_status status;
 
-       } while (cpu_len);
-
-       /* Should not happen */
-       if (seg_len & 0x1f)
-               DALGN |= (1 << pd->dma_dreq);
+       status = dmaengine_tx_status(pd->dma_chan, pd->dma_cookie, NULL);
+       if (status == DMA_ERROR || status == DMA_COMPLETE)
+               complete(&pd->dma_done);
 }
 
 /*
@@ -105,28 +62,22 @@ static void pxa_load_dmac(struct scatterlist *sg, struct ata_queued_cmd *qc)
 static void pxa_qc_prep(struct ata_queued_cmd *qc)
 {
        struct pata_pxa_data *pd = qc->ap->private_data;
-       int si = 0;
-       struct scatterlist *sg;
+       struct dma_async_tx_descriptor *tx;
+       enum dma_transfer_direction dir;
 
        if (!(qc->flags & ATA_QCFLAG_DMAMAP))
                return;
 
-       pd->dma_desc_id = 0;
-
-       DCSR(pd->dma_channel) = 0;
-       DALGN &= ~(1 << pd->dma_dreq);
-
-       for_each_sg(qc->sg, sg, qc->n_elem, si)
-               pxa_load_dmac(sg, qc);
-
-       pd->dma_desc[pd->dma_desc_id - 1].ddadr = DDADR_STOP;
-
-       /* Fire IRQ only at the end of last block */
-       pd->dma_desc[pd->dma_desc_id - 1].dcmd |= DCMD_ENDIRQEN;
-
-       DDADR(pd->dma_channel) = pd->dma_desc_addr;
-       DRCMR(pd->dma_dreq) = DRCMR_MAPVLD | pd->dma_channel;
-
+       dir = (qc->dma_dir == DMA_TO_DEVICE ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM);
+       tx = dmaengine_prep_slave_sg(pd->dma_chan, qc->sg, qc->n_elem, dir,
+                                    DMA_PREP_INTERRUPT);
+       if (!tx) {
+               ata_dev_err(qc->dev, "prep_slave_sg() failed\n");
+               return;
+       }
+       tx->callback = pxa_ata_dma_irq;
+       tx->callback_param = pd;
+       pd->dma_cookie = dmaengine_submit(tx);
 }
 
 /*
@@ -145,7 +96,7 @@ static void pxa_bmdma_start(struct ata_queued_cmd *qc)
 {
        struct pata_pxa_data *pd = qc->ap->private_data;
        init_completion(&pd->dma_done);
-       DCSR(pd->dma_channel) = DCSR_RUN;
+       dma_async_issue_pending(pd->dma_chan);
 }
 
 /*
@@ -154,12 +105,14 @@ static void pxa_bmdma_start(struct ata_queued_cmd *qc)
 static void pxa_bmdma_stop(struct ata_queued_cmd *qc)
 {
        struct pata_pxa_data *pd = qc->ap->private_data;
+       enum dma_status status;
 
-       if ((DCSR(pd->dma_channel) & DCSR_RUN) &&
-               wait_for_completion_timeout(&pd->dma_done, HZ))
-               dev_err(qc->ap->dev, "Timeout waiting for DMA completion!");
+       status = dmaengine_tx_status(pd->dma_chan, pd->dma_cookie, NULL);
+       if (status != DMA_ERROR && status != DMA_COMPLETE &&
+           wait_for_completion_timeout(&pd->dma_done, HZ))
+               ata_dev_err(qc->dev, "Timeout waiting for DMA completion!");
 
-       DCSR(pd->dma_channel) = 0;
+       dmaengine_terminate_all(pd->dma_chan);
 }
 
 /*
@@ -170,8 +123,11 @@ static unsigned char pxa_bmdma_status(struct ata_port *ap)
 {
        struct pata_pxa_data *pd = ap->private_data;
        unsigned char ret = ATA_DMA_INTR;
+       struct dma_tx_state state;
+       enum dma_status status;
 
-       if (pd->dma_dcsr & DCSR_BUSERR)
+       status = dmaengine_tx_status(pd->dma_chan, pd->dma_cookie, &state);
+       if (status != DMA_COMPLETE)
                ret |= ATA_DMA_ERR;
 
        return ret;
@@ -213,21 +169,6 @@ static struct ata_port_operations pxa_ata_port_ops = {
        .qc_prep                = pxa_qc_prep,
 };
 
-/*
- * DMA interrupt handler.
- */
-static void pxa_ata_dma_irq(int dma, void *port)
-{
-       struct ata_port *ap = port;
-       struct pata_pxa_data *pd = ap->private_data;
-
-       pd->dma_dcsr = DCSR(dma);
-       DCSR(dma) = pd->dma_dcsr;
-
-       if (pd->dma_dcsr & DCSR_STOPSTATE)
-               complete(&pd->dma_done);
-}
-
 static int pxa_ata_probe(struct platform_device *pdev)
 {
        struct ata_host *host;
@@ -238,6 +179,9 @@ static int pxa_ata_probe(struct platform_device *pdev)
        struct resource *dma_res;
        struct resource *irq_res;
        struct pata_pxa_pdata *pdata = dev_get_platdata(&pdev->dev);
+       struct dma_slave_config config;
+       dma_cap_mask_t mask;
+       struct pxad_param param;
        int ret = 0;
 
        /*
@@ -333,29 +277,32 @@ static int pxa_ata_probe(struct platform_device *pdev)
                return -ENOMEM;
 
        ap->private_data = data;
-       data->dma_dreq = pdata->dma_dreq;
-       data->dma_io_addr = dma_res->start;
 
-       /*
-        * Allocate space for the DMA descriptors
-        */
-       data->dma_desc = dmam_alloc_coherent(&pdev->dev, PAGE_SIZE,
-                                       &data->dma_desc_addr, GFP_KERNEL);
-       if (!data->dma_desc)
-               return -EINVAL;
+       dma_cap_zero(mask);
+       dma_cap_set(DMA_SLAVE, mask);
+       param.prio = PXAD_PRIO_LOWEST;
+       param.drcmr = pdata->dma_dreq;
+       memset(&config, 0, sizeof(config));
+       config.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
+       config.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
+       config.src_addr = dma_res->start;
+       config.dst_addr = dma_res->start;
+       config.src_maxburst = 32;
+       config.dst_maxburst = 32;
 
        /*
         * Request the DMA channel
         */
-       data->dma_channel = pxa_request_dma(DRV_NAME, DMA_PRIO_LOW,
-                                               pxa_ata_dma_irq, ap);
-       if (data->dma_channel < 0)
+       data->dma_chan =
+               dma_request_slave_channel_compat(mask, pxad_filter_fn,
+                                                &param, &pdev->dev, "data");
+       if (!data->dma_chan)
                return -EBUSY;
-
-       /*
-        * Stop and clear the DMA channel
-        */
-       DCSR(data->dma_channel) = 0;
+       ret = dmaengine_slave_config(data->dma_chan, &config);
+       if (ret < 0) {
+               dev_err(&pdev->dev, "dma configuration failed: %d\n", ret);
+               return ret;
+       }
 
        /*
         * Activate the ATA host
@@ -363,7 +310,7 @@ static int pxa_ata_probe(struct platform_device *pdev)
        ret = ata_host_activate(host, irq_res->start, ata_sff_interrupt,
                                pdata->irq_flags, &pxa_ata_sht);
        if (ret)
-               pxa_free_dma(data->dma_channel);
+               dma_release_channel(data->dma_chan);
 
        return ret;
 }
@@ -373,7 +320,7 @@ static int pxa_ata_remove(struct platform_device *pdev)
        struct ata_host *host = platform_get_drvdata(pdev);
        struct pata_pxa_data *data = host->ports[0]->private_data;
 
-       pxa_free_dma(data->dma_channel);
+       dma_release_channel(data->dma_chan);
 
        ata_host_detach(host);