[media] omap3isp: stat: Merge dma_addr and iommu_addr fields
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Thu, 2 Jan 2014 13:27:12 +0000 (10:27 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Sun, 25 May 2014 14:09:25 +0000 (11:09 -0300)
The fields store buffer addresses as seen from the device. The first one
is used with an external DMA engine while the second one is used with
the ISP DMA engine. As they're never used together, merge them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/platform/omap3isp/isph3a_aewb.c
drivers/media/platform/omap3isp/isph3a_af.c
drivers/media/platform/omap3isp/ispstat.c
drivers/media/platform/omap3isp/ispstat.h

index 75fd82b152ba362f97bafef11a4e8bbffd444fb0..d6811ce263eb113102cceb7611a42e4c5f21f11d 100644 (file)
@@ -47,7 +47,7 @@ static void h3a_aewb_setup_regs(struct ispstat *aewb, void *priv)
        if (aewb->state == ISPSTAT_DISABLED)
                return;
 
-       isp_reg_writel(aewb->isp, aewb->active_buf->iommu_addr,
+       isp_reg_writel(aewb->isp, aewb->active_buf->dma_addr,
                       OMAP3_ISP_IOMEM_H3A, ISPH3A_AEWBUFST);
 
        if (!aewb->update)
index a0bf5af32438559958b39c1d62360e35d491ad48..6fc960cd30f57accab300b749aa7049dcf5efd28 100644 (file)
@@ -51,7 +51,7 @@ static void h3a_af_setup_regs(struct ispstat *af, void *priv)
        if (af->state == ISPSTAT_DISABLED)
                return;
 
-       isp_reg_writel(af->isp, af->active_buf->iommu_addr, OMAP3_ISP_IOMEM_H3A,
+       isp_reg_writel(af->isp, af->active_buf->dma_addr, OMAP3_ISP_IOMEM_H3A,
                       ISPH3A_AFBUFST);
 
        if (!af->update)
index b1eb90210388bf9751d1eb6044d2b638414b633c..dba713f2a0d0256eb860dccfc4e9a7363c5f75d2 100644 (file)
@@ -361,21 +361,19 @@ static void isp_stat_bufs_free(struct ispstat *stat)
                struct ispstat_buffer *buf = &stat->buf[i];
 
                if (!ISP_STAT_USES_DMAENGINE(stat)) {
-                       if (IS_ERR_OR_NULL((void *)buf->iommu_addr))
+                       if (IS_ERR_OR_NULL((void *)buf->dma_addr))
                                continue;
                        if (buf->iovm)
                                dma_unmap_sg(isp->dev, buf->iovm->sgt->sgl,
                                             buf->iovm->sgt->nents,
                                             DMA_FROM_DEVICE);
-                       omap_iommu_vfree(isp->domain, isp->dev,
-                                                       buf->iommu_addr);
+                       omap_iommu_vfree(isp->domain, isp->dev, buf->dma_addr);
                } else {
                        if (!buf->virt_addr)
                                continue;
                        dma_free_coherent(stat->isp->dev, stat->buf_alloc_size,
                                          buf->virt_addr, buf->dma_addr);
                }
-               buf->iommu_addr = 0;
                buf->iovm = NULL;
                buf->dma_addr = 0;
                buf->virt_addr = NULL;
@@ -396,12 +394,12 @@ static int isp_stat_bufs_alloc_iommu(struct ispstat *stat,
        struct isp_device *isp = stat->isp;
        struct iovm_struct *iovm;
 
-       buf->iommu_addr = omap_iommu_vmalloc(isp->domain, isp->dev, 0,
-                                               size, IOMMU_FLAG);
-       if (IS_ERR((void *)buf->iommu_addr))
+       buf->dma_addr = omap_iommu_vmalloc(isp->domain, isp->dev, 0,
+                                          size, IOMMU_FLAG);
+       if (IS_ERR_VALUE(buf->dma_addr))
                return -ENOMEM;
 
-       iovm = omap_find_iovm_area(isp->dev, buf->iommu_addr);
+       iovm = omap_find_iovm_area(isp->dev, buf->dma_addr);
        if (!iovm)
                return -ENOMEM;
 
@@ -410,8 +408,7 @@ static int isp_stat_bufs_alloc_iommu(struct ispstat *stat,
                return -ENOMEM;
 
        buf->iovm = iovm;
-       buf->virt_addr = omap_da_to_va(stat->isp->dev,
-                                 (u32)buf->iommu_addr);
+       buf->virt_addr = omap_da_to_va(stat->isp->dev, buf->dma_addr);
 
        return 0;
 }
@@ -478,8 +475,8 @@ static int isp_stat_bufs_alloc(struct ispstat *stat, u32 size)
                buf->empty = 1;
 
                dev_dbg(stat->isp->dev,
-                       "%s: buffer[%u] allocated. iommu=0x%08lx dma=0x%08lx virt=0x%08lx",
-                       stat->subdev.name, i, buf->iommu_addr,
+                       "%s: buffer[%u] allocated. dma=0x%08lx virt=0x%08lx",
+                       stat->subdev.name, i,
                        (unsigned long)buf->dma_addr,
                        (unsigned long)buf->virt_addr);
        }
index 9a047c929b9f95d47a758267cc341c92bd4f5c8c..8e76846da8d6bc83ba3df072ca4448bed3ff42d9 100644 (file)
@@ -46,7 +46,6 @@
 struct ispstat;
 
 struct ispstat_buffer {
-       unsigned long iommu_addr;
        struct iovm_struct *iovm;
        void *virt_addr;
        dma_addr_t dma_addr;