]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
Xilinx: ARM: DMA: Updated to latest kernel changes.
authorSrikanthT <sthokal@xilinx.com>
Sun, 9 Sep 2012 17:53:43 +0000 (23:23 +0530)
committerJohn Linn <john.linn@xilinx.com>
Fri, 21 Sep 2012 16:15:39 +0000 (09:15 -0700)
In the latest kernel, there are some API changes and also
there is a new enum defined. This patch is created to
update these changes. The changes are in brief,
1. API 'prep_slave_sg' is modified to take an additional
   argument 'void *context'.
2. A new enum 'dma_transfer_direction' has been added.
   This replaces 'dma_data_direction' enum.
All the files which need this changes are updated.

Signed-off-by: SrikanthT <sthokal@xilinx.com>
drivers/dma/dmatest.c.cdma_dma
drivers/dma/dmatest.c.vdma
drivers/dma/xilinx_dma.c
include/linux/amba/xilinx_dma.h

index 1e38fb4d91b5a997bb605e8cf7c13d10e2c94cf3..8076b7509e99dd6f3fa11d650b22cf13b5040032 100755 (executable)
@@ -354,14 +354,14 @@ static int dmatest_func(void *data)
                        u8 *buf = thread->srcs[i] + src_off;
 
                        dma_srcs[i] = dma_map_single(dev->dev, buf, len,
-                                                    DMA_TO_DEVICE);
+                                                    DMA_MEM_TO_DEV);
                }
-               /* map with DMA_BIDIRECTIONAL to force writeback/invalidate */
+               /* map with DMA_MEM_TO_MEM to force writeback/invalidate */
                for (i = 0; i < dst_cnt; i++) {
        
                        dma_dsts[i] = dma_map_single(dev->dev, thread->dsts[i],
                                                     test_buf_size,
-                                                    DMA_BIDIRECTIONAL);
+                                                    DMA_MEM_TO_MEM);
                }
 
 
@@ -396,11 +396,11 @@ static int dmatest_func(void *data)
                if (!tx) {
                        for (i = 0; i < src_cnt; i++)
                                dma_unmap_single(dev->dev, dma_srcs[i], len,
-                                                DMA_TO_DEVICE);
+                                                DMA_MEM_TO_DEV);
                        for (i = 0; i < dst_cnt; i++)
                                dma_unmap_single(dev->dev, dma_dsts[i],
                                                 test_buf_size,
-                                                DMA_BIDIRECTIONAL);
+                                                DMA_MEM_TO_MEM);
                        pr_warning("%s: #%u: prep error with src_off=0x%x "
                                        "dst_off=0x%x len=0x%x\n",
                                        thread_name, total_tests - 1,
@@ -448,7 +448,7 @@ static int dmatest_func(void *data)
                /* Unmap by myself (see DMA_COMPL_SKIP_DEST_UNMAP above) */
                for (i = 0; i < dst_cnt; i++)
                        dma_unmap_single(dev->dev, dma_dsts[i], test_buf_size,
-                                        DMA_BIDIRECTIONAL);
+                                        DMA_MEM_TO_MEM);
 
                error_count = 0;
 
@@ -618,7 +618,7 @@ static int dmatest_slave_func(void *data)
 
        
                        dma_srcs[i] = dma_map_single(tx_dev->dev, buf, len,
-                                                    DMA_TO_DEVICE);
+                                                    DMA_MEM_TO_DEV);
 
                }
 
@@ -626,15 +626,15 @@ static int dmatest_slave_func(void *data)
        
                        dma_dsts[i] = dma_map_single(rx_dev->dev, thread->dsts[i],
                                                     test_buf_size,
-                                                    DMA_TO_DEVICE);
+                                                    DMA_MEM_TO_DEV);
 
                        dma_unmap_single(rx_dev->dev, dma_dsts[i],
                                                 test_buf_size,
-                                                DMA_TO_DEVICE);
+                                                DMA_MEM_TO_DEV);
 
                        dma_dsts[i] = dma_map_single(rx_dev->dev, thread->dsts[i],
                                                     test_buf_size,
-                                                    DMA_FROM_DEVICE);
+                                                    DMA_DEV_TO_MEM);
                }
 
                sg_init_table(tx_sg, bd_cnt);
@@ -662,19 +662,19 @@ static int dmatest_slave_func(void *data)
                             (unsigned long)&config);
 
                rxd = rx_dev->device_prep_slave_sg(rx_chan, rx_sg, bd_cnt,
-                               DMA_FROM_DEVICE, flags);
+                               DMA_DEV_TO_MEM, flags, NULL);
 
                txd = tx_dev->device_prep_slave_sg(tx_chan, tx_sg, bd_cnt,
-                               DMA_TO_DEVICE, flags);
+                               DMA_MEM_TO_DEV, flags, NULL);
 
                if (!rxd || !txd) {
                        for (i = 0; i < src_cnt; i++)
                                dma_unmap_single(tx_dev->dev, dma_srcs[i], len,
-                                                DMA_TO_DEVICE);
+                                                DMA_MEM_TO_DEV);
                        for (i = 0; i < dst_cnt; i++)
                                dma_unmap_single(rx_dev->dev, dma_dsts[i],
                                                 test_buf_size,
-                                                DMA_FROM_DEVICE);
+                                                DMA_DEV_TO_MEM);
                        pr_warning("%s: #%u: prep error with src_off=0x%x "
                                        "dst_off=0x%x len=0x%x\n",
                                        thread_name, total_tests - 1,
@@ -744,7 +744,7 @@ static int dmatest_slave_func(void *data)
                /* Unmap by myself (see DMA_COMPL_SKIP_DEST_UNMAP above) */
                for (i = 0; i < dst_cnt; i++)
                        dma_unmap_single(rx_dev->dev, dma_dsts[i], test_buf_size,
-                                        DMA_FROM_DEVICE);
+                                        DMA_DEV_TO_MEM);
 
                error_count = 0;
 
@@ -1024,7 +1024,7 @@ static int __init dmatest_init(void)
                dma_cap_zero(mask);
                dma_cap_set(DMA_SLAVE | DMA_PRIVATE, mask);
 
-               direction = DMA_TO_DEVICE;
+               direction = DMA_MEM_TO_DEV;
                match = (direction & 0xFF) | XILINX_DMA_IP_DMA;
                pr_info("match is %x\n", match);
 
@@ -1036,7 +1036,7 @@ static int __init dmatest_init(void)
                        pr_info("Did not find tx device\n");
                }
                
-               direction = DMA_FROM_DEVICE;
+               direction = DMA_DEV_TO_MEM;
                match = (direction & 0xFF) | XILINX_DMA_IP_DMA;
                rx_chan = dma_request_channel(mask, xdma_filter, &match);
 
index 20968ae5adc4303f853f42611949c7d26482f0f3..f26d1046982627c7642a182546d380cff89a3b11 100755 (executable)
@@ -356,14 +356,14 @@ static int dmatest_func(void *data)
                        u8 *buf = thread->srcs[i] + src_off;
 
                        dma_srcs[i] = dma_map_single(dev->dev, buf, len,
-                                                    DMA_TO_DEVICE);
+                                                    DMA_MEM_TO_DEV);
                }
-               /* map with DMA_BIDIRECTIONAL to force writeback/invalidate */
+               /* map with DMA_MEM_TO_MEM to force writeback/invalidate */
                for (i = 0; i < dst_cnt; i++) {
        
                        dma_dsts[i] = dma_map_single(dev->dev, thread->dsts[i],
                                                     test_buf_size,
-                                                    DMA_BIDIRECTIONAL);
+                                                    DMA_MEM_TO_MEM);
                }
 
 
@@ -398,11 +398,11 @@ static int dmatest_func(void *data)
                if (!tx) {
                        for (i = 0; i < src_cnt; i++)
                                dma_unmap_single(dev->dev, dma_srcs[i], len,
-                                                DMA_TO_DEVICE);
+                                                DMA_MEM_TO_DEV);
                        for (i = 0; i < dst_cnt; i++)
                                dma_unmap_single(dev->dev, dma_dsts[i],
                                                 test_buf_size,
-                                                DMA_BIDIRECTIONAL);
+                                                DMA_MEM_TO_MEM);
                        pr_warning("%s: #%u: prep error with src_off=0x%x "
                                        "dst_off=0x%x len=0x%x\n",
                                        thread_name, total_tests - 1,
@@ -450,7 +450,7 @@ static int dmatest_func(void *data)
                /* Unmap by myself (see DMA_COMPL_SKIP_DEST_UNMAP above) */
                for (i = 0; i < dst_cnt; i++)
                        dma_unmap_single(dev->dev, dma_dsts[i], test_buf_size,
-                                        DMA_BIDIRECTIONAL);
+                                        DMA_MEM_TO_MEM);
 
                error_count = 0;
 
@@ -615,7 +615,7 @@ static int dmatest_slave_func(void *data)
                        u8 *buf = thread->srcs[i];
 
                        dma_srcs[i] = dma_map_single(tx_dev->dev, buf, len,
-                                                    DMA_TO_DEVICE);
+                                                    DMA_MEM_TO_DEV);
                        pr_debug("src buf %x dma %x\n", (unsigned int)buf, dma_srcs[i]);
                        sg_dma_address(&tx_sg[i]) = dma_srcs[i];
                        sg_dma_len(&tx_sg[i]) = len;
@@ -625,14 +625,14 @@ static int dmatest_slave_func(void *data)
        
                        dma_dsts[i] = dma_map_single(rx_dev->dev, thread->dsts[i],
                                                     test_buf_size,
-                                                    DMA_FROM_DEVICE);
+                                                    DMA_DEV_TO_MEM);
                        pr_debug("dst %x dma %x\n", thread->dsts[i], dma_dsts[i]);
                        sg_dma_address(&rx_sg[i]) = dma_dsts[i];
                        sg_dma_len(&rx_sg[i]) = len;
                }
 
                /* Set up hardware configuration information */
-               config.direction = DMA_TO_DEVICE;
+               config.direction = DMA_MEM_TO_DEV;
                config.vsize = vsize;
                config.hsize = hsize;
                config.stride = hsize;
@@ -648,24 +648,24 @@ static int dmatest_slave_func(void *data)
                config.disable_intr = 0;
                tx_dev->device_control(tx_chan, DMA_SLAVE_CONFIG, (unsigned long)&config);
 
-               config.direction = DMA_FROM_DEVICE;
+               config.direction = DMA_DEV_TO_MEM;
                config.park = 0;
                rx_dev->device_control(rx_chan, DMA_SLAVE_CONFIG, (unsigned long)&config);
 
                rxd = rx_dev->device_prep_slave_sg(rx_chan, rx_sg, frm_cnt,
-                               DMA_FROM_DEVICE, flags);
+                               DMA_DEV_TO_MEM, flags, NULL);
 
                txd = tx_dev->device_prep_slave_sg(tx_chan, tx_sg, frm_cnt,
-                               DMA_TO_DEVICE, flags);
+                               DMA_MEM_TO_DEV, flags, NULL);
 
                if (!rxd || !txd) {
                        for (i = 0; i < frm_cnt; i++)
                                dma_unmap_single(tx_dev->dev, dma_srcs[i], len,
-                                                DMA_TO_DEVICE);
+                                                DMA_MEM_TO_DEV);
                        for (i = 0; i < frm_cnt; i++)
                                dma_unmap_single(rx_dev->dev, dma_dsts[i],
                                                 test_buf_size,
-                                                DMA_FROM_DEVICE);
+                                                DMA_DEV_TO_MEM);
                        pr_warning("%s: #%u: prep error with len=0x%x ",
                                        thread_name, total_tests - 1, len);
                        msleep(100);
@@ -734,7 +734,7 @@ static int dmatest_slave_func(void *data)
                /* Unmap by myself (see DMA_COMPL_SKIP_DEST_UNMAP above) */
                for (i = 0; i < frm_cnt; i++)
                        dma_unmap_single(rx_dev->dev, dma_dsts[i], test_buf_size,
-                                        DMA_FROM_DEVICE);
+                                        DMA_DEV_TO_MEM);
 
                error_count = 0;
 
@@ -1004,7 +1004,7 @@ static int __init dmatest_init(void)
                dma_cap_zero(mask);
                dma_cap_set(DMA_SLAVE | DMA_PRIVATE, mask);
 
-               direction = DMA_TO_DEVICE;
+               direction = DMA_MEM_TO_DEV;
                match = (direction & 0xFF) | XILINX_DMA_IP_VDMA;
                pr_info("match is %x\n", match);
 
@@ -1016,7 +1016,7 @@ static int __init dmatest_init(void)
                        pr_info("Did not find tx device\n");
                }
                
-               direction = DMA_FROM_DEVICE;
+               direction = DMA_DEV_TO_MEM;
                match = (direction & 0xFF) | XILINX_DMA_IP_VDMA;
                rx_chan = dma_request_channel(mask, xdma_filter, &match);
 
index 55651e4919c26750beebe4ba05f8a659bb96e7d3..97ef15d205505b1b9a2bdcc07eaf0dadf024c2b7 100644 (file)
@@ -219,7 +219,7 @@ struct xilinx_dma_chan {
        struct device *dev;               /* The dma device */
        int    irq;                       /* Channel IRQ */
        int    id;                        /* Channel ID */
-       enum dma_data_direction direction;/* Transfer direction */
+       enum dma_transfer_direction direction;/* Transfer direction */
        int    max_len;                   /* Maximum data len per transfer */
        int    is_lite;                   /* Whether is light build */
        int    num_frms;                  /* Number of frames */
@@ -708,7 +708,7 @@ static void xilinx_vdma_start_transfer(struct xilinx_dma_chan *chan)
        DMA_OUT(&chan->regs->cr, reg);
 
        if ((config->park_frm >= 0) && (config->park_frm < chan->num_frms)) {
-               if (config->direction == DMA_TO_DEVICE) {
+               if (config->direction == DMA_MEM_TO_DEV) {
                        chan_base = (char *)chan->regs;
                        DMA_OUT((chan_base + XILINX_VDMA_PARK_REG_OFFSET),
                                        config->park_frm);
@@ -1136,7 +1136,8 @@ fail:
  */
 static struct dma_async_tx_descriptor *xilinx_dma_prep_slave_sg(
        struct dma_chan *dchan, struct scatterlist *sgl, unsigned int sg_len,
-       enum dma_data_direction direction, unsigned long flags)
+       enum dma_transfer_direction direction, unsigned long flags,
+       void *context)
 {
        struct xilinx_dma_chan *chan;
        struct xilinx_dma_desc_sw *first = NULL, *prev = NULL, *new = NULL;
@@ -1203,14 +1204,14 @@ static struct dma_async_tx_descriptor *xilinx_dma_prep_slave_sg(
                         * If this is not the first descriptor, chain the
                         * current descriptor after the previous descriptor
                         *
-                        * For the first DMA_TO_DEVICE transfer, set SOP
+                        * For the first DMA_MEM_TO_DEV transfer, set SOP
                         */
                        if (!first) {
                                first = new;
-                               if (direction == DMA_TO_DEVICE) {
+                               if (direction == DMA_MEM_TO_DEV) {
                                        hw->control |= XILINX_DMA_BD_SOP;
 #ifdef TEST_DMA_WITH_LOOPBACK
-                                       hw->app_4 = copy;
+                                       hw->app_4 = total_len;
 #endif
                                }
                        } else {
@@ -1232,7 +1233,7 @@ static struct dma_async_tx_descriptor *xilinx_dma_prep_slave_sg(
        /* Link the last BD with the first BD */
        hw->next_desc = first->async_tx.phys;
 
-       if (direction == DMA_TO_DEVICE)
+       if (direction == DMA_MEM_TO_DEV)
                hw->control |= XILINX_DMA_BD_EOP;
 
        /* All scatter gather list entries has length == 0 */
@@ -1273,7 +1274,8 @@ fail:
  */
 static struct dma_async_tx_descriptor *xilinx_vdma_prep_slave_sg(
        struct dma_chan *dchan, struct scatterlist *sgl, unsigned int sg_len,
-       enum dma_data_direction direction, unsigned long flags)
+       enum dma_transfer_direction direction, unsigned long flags,
+       void *context)
 {
        struct xilinx_dma_chan *chan;
        struct xilinx_dma_desc_sw *first = NULL, *prev = NULL, *new = NULL;
@@ -1638,7 +1640,7 @@ static int __devinit xilinx_dma_chan_probe(struct xilinx_dma_device *xdev,
                flush_fsync = be32_to_cpup(value);
 
        if (feature & XILINX_DMA_IP_CDMA) {
-               chan->direction = DMA_BIDIRECTIONAL;
+               chan->direction = DMA_MEM_TO_MEM;
                chan->start_transfer = xilinx_cdma_start_transfer;
 
                chan->has_SG = (xdev->feature & XILINX_DMA_FTR_HAS_SG) >>
@@ -1672,11 +1674,11 @@ static int __devinit xilinx_dma_chan_probe(struct xilinx_dma_device *xdev,
 
                if (of_device_is_compatible(node,
                         "xlnx,axi-dma-mm2s-channel"))
-                       chan->direction = DMA_TO_DEVICE;
+                       chan->direction = DMA_MEM_TO_DEV;
 
                if (of_device_is_compatible(node,
                                "xlnx,axi-dma-s2mm-channel"))
-                       chan->direction = DMA_FROM_DEVICE;
+                       chan->direction = DMA_DEV_TO_MEM;
 
        }
 
@@ -1688,7 +1690,7 @@ static int __devinit xilinx_dma_chan_probe(struct xilinx_dma_device *xdev,
 
                if (of_device_is_compatible(node,
                                "xlnx,axi-vdma-mm2s-channel")) {
-                       chan->direction = DMA_TO_DEVICE;
+                       chan->direction = DMA_MEM_TO_DEV;
                        if (!chan->has_SG) {
                                chan->addr_regs = (struct vdma_addr_regs *)
                                    ((u32)xdev->regs +
@@ -1701,7 +1703,7 @@ static int __devinit xilinx_dma_chan_probe(struct xilinx_dma_device *xdev,
 
                if (of_device_is_compatible(node,
                                "xlnx,axi-vdma-s2mm-channel")) {
-                       chan->direction = DMA_FROM_DEVICE;
+                       chan->direction = DMA_DEV_TO_MEM;
                        if (!chan->has_SG) {
                                chan->addr_regs = (struct vdma_addr_regs *)
                                    ((u32)xdev->regs +
@@ -1717,7 +1719,7 @@ static int __devinit xilinx_dma_chan_probe(struct xilinx_dma_device *xdev,
        chan->regs = (struct xdma_regs *)xdev->regs;
        chan->id = 0;
 
-       if (chan->direction == DMA_FROM_DEVICE) {
+       if (chan->direction == DMA_DEV_TO_MEM) {
                chan->regs = (struct xdma_regs *)((u32)xdev->regs +
                                        XILINX_DMA_RX_CHANNEL_OFFSET);
                chan->id = 1;
@@ -1901,7 +1903,7 @@ out_return:
        return err;
 }
 
-static int xilinx_dma_of_remove(struct platform_device *op)
+static int __devexit xilinx_dma_of_remove(struct platform_device *op)
 {
        struct xilinx_dma_device *xdev;
        int i;
@@ -1935,7 +1937,7 @@ static struct platform_driver xilinx_dma_of_driver = {
                .of_match_table = xilinx_dma_of_ids,
        },
        .probe = xilinx_dma_of_probe,
-       .remove = xilinx_dma_of_remove,
+       .remove = __devexit_p(xilinx_dma_of_remove),
 };
 
 /*----------------------------------------------------------------------------*/
@@ -2024,7 +2026,7 @@ static int __devinit xilinx_dma_chan_probe(struct platform_device *pdev,
 
        if (feature & XILINX_DMA_IP_CDMA) {
 
-               chan->direction = DMA_BIDIRECTIONAL;
+               chan->direction = DMA_MEM_TO_MEM;
                chan->start_transfer = xilinx_cdma_start_transfer;
 
                chan->has_SG = (xdev->feature & XILINX_DMA_FTR_HAS_SG) >>
@@ -2041,10 +2043,10 @@ static int __devinit xilinx_dma_chan_probe(struct platform_device *pdev,
                chan->start_transfer = xilinx_dma_start_transfer;
 
                if (!strcmp(channel_config->type, "axi-dma-mm2s-channel"))
-                       chan->direction = DMA_TO_DEVICE;
+                       chan->direction = DMA_MEM_TO_DEV;
 
                if (!strcmp(channel_config->type, "axi-dma-s2mm-channel"))
-                       chan->direction = DMA_FROM_DEVICE;
+                       chan->direction = DMA_DEV_TO_MEM;
        }
 
        if (feature & XILINX_DMA_IP_VDMA) {
@@ -2058,7 +2060,7 @@ static int __devinit xilinx_dma_chan_probe(struct platform_device *pdev,
 
                        printk(KERN_INFO, "axi-vdma-mm2s-channel found\n");
 
-                       chan->direction = DMA_TO_DEVICE;
+                       chan->direction = DMA_MEM_TO_DEV;
                        if (!chan->has_SG) {
                                chan->addr_regs = (struct vdma_addr_regs *)
                                ((u32)xdev->regs +
@@ -2070,7 +2072,7 @@ static int __devinit xilinx_dma_chan_probe(struct platform_device *pdev,
 
                        printk(KERN_INFO, "axi-vdma-s2mm-channel found\n");
 
-                       chan->direction = DMA_FROM_DEVICE;
+                       chan->direction = DMA_DEV_TO_MEM;
                        if (!chan->has_SG) {
                                chan->addr_regs = (struct vdma_addr_regs *)
                                ((u32)xdev->regs +
@@ -2083,7 +2085,7 @@ static int __devinit xilinx_dma_chan_probe(struct platform_device *pdev,
        chan->regs = (struct xdma_regs *)xdev->regs;
        chan->id = 0;
 
-       if (chan->direction == DMA_FROM_DEVICE) {
+       if (chan->direction == DMA_DEV_TO_MEM) {
                chan->regs = (struct xdma_regs *)((u32)xdev->regs +
                                        XILINX_DMA_RX_CHANNEL_OFFSET);
                chan->id = 1;
index d54be52ec714270df7dc1f197a96f5a3b0d44562..751a74339821ad9b86fc12abcead330a3cc50c1c 100644 (file)
@@ -53,7 +53,7 @@
  * If used to set interrupt coalescing and delay counter only for
  * Xilinx VDMA, hsize must be -1 */
 struct xilinx_dma_config {
-       enum dma_data_direction direction; /* Channel direction */
+       enum dma_transfer_direction direction; /* Channel direction */
        int vsize;                         /* Vertical size */
        int hsize;                         /* Horizontal size */
        int stride;                        /* Stride */