diff for duplicates of <52061C53.4050905@gmail.com> diff --git a/a/1.txt b/N1/1.txt index 67f89b3..90f61a2 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -64,3 +64,11 @@ compile, it's really just a snapshot. Thanks, Daniel + +-------------- next part -------------- +A non-text attachment was scrubbed... +Name: 0001-drivers-media-platform-soc_camera-pxa_camera.c-DMAEN.patch +Type: text/x-patch +Size: 13827 bytes +Desc: not available +URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130810/d527dc67/attachment-0001.bin> diff --git a/a/2.hdr b/a/2.hdr deleted file mode 100644 index e5174ac..0000000 --- a/a/2.hdr +++ /dev/null @@ -1,6 +0,0 @@ -Content-Type: text/x-patch; - name="0001-drivers-media-platform-soc_camera-pxa_camera.c-DMAEN.patch" -Content-Transfer-Encoding: 7bit -Content-Disposition: attachment; - filename*0="0001-drivers-media-platform-soc_camera-pxa_camera.c-DMAEN.pa"; - filename*1="tch" diff --git a/a/2.txt b/a/2.txt deleted file mode 100644 index a20d383..0000000 --- a/a/2.txt +++ /dev/null @@ -1,460 +0,0 @@ ->From 8d7333689479640d2586358ffb8f4e1704e4b015 Mon Sep 17 00:00:00 2001 -From: Daniel Mack <zonque@gmail.com> -Date: Sun, 4 Aug 2013 00:23:00 +0200 -Subject: [PATCH] drivers/media/platform/soc_camera/pxa_camera.c DMAENGINE WIP - ---- - drivers/media/platform/soc_camera/pxa_camera.c | 262 ++++++++++++------------- - 1 file changed, 121 insertions(+), 141 deletions(-) - -diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/soc_camera/pxa_camera.c -index d4df305..4dfd97f 100644 ---- a/drivers/media/platform/soc_camera/pxa_camera.c -+++ b/drivers/media/platform/soc_camera/pxa_camera.c -@@ -28,6 +28,9 @@ - #include <linux/clk.h> - #include <linux/sched.h> - #include <linux/slab.h> -+#include <linux/dmaengine.h> -+#include <linux/dma-mapping.h> -+#include <linux/dma/mmp-pdma.h> - - #include <media/v4l2-common.h> - #include <media/v4l2-dev.h> -@@ -37,7 +40,6 @@ - - #include <linux/videodev2.h> - --#include <mach/dma.h> - #include <linux/platform_data/camera-pxa.h> - - #define PXA_CAM_VERSION "0.0.6" -@@ -177,8 +179,6 @@ enum pxa_camera_active_dma { - /* descriptor needed for the PXA DMA engine */ - struct pxa_cam_dma { - dma_addr_t sg_dma; -- struct pxa_dma_desc *sg_cpu; -- size_t sg_size; - int sglen; - }; - -@@ -206,7 +206,8 @@ struct pxa_camera_dev { - void __iomem *base; - - int channels; -- unsigned int dma_chans[3]; -+ struct dma_chan *dma_chans[3]; -+ unsigned int dma_len; - - struct pxacamera_platform_data *pdata; - struct resource *res; -@@ -257,15 +258,18 @@ static int pxa_videobuf_setup(struct videobuf_queue *vq, unsigned int *count, - static void free_buffer(struct videobuf_queue *vq, struct pxa_buffer *buf) - { - struct soc_camera_device *icd = vq->priv_data; -- struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - struct videobuf_dmabuf *dma = videobuf_to_dma(&buf->vb); -- int i; - - BUG_ON(in_interrupt()); - - dev_dbg(icd->parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__, - &buf->vb, buf->vb.baddr, buf->vb.bsize); - -+ /* FIXME */ -+ dmaengine_terminate_all(NULL); -+ dmaengine_terminate_all(NULL); -+ dmaengine_terminate_all(NULL); -+ - /* - * This waits until this buffer is out of danger, i.e., until it is no - * longer in STATE_QUEUED or STATE_ACTIVE -@@ -274,15 +278,6 @@ static void free_buffer(struct videobuf_queue *vq, struct pxa_buffer *buf) - videobuf_dma_unmap(vq->dev, dma); - videobuf_dma_free(dma); - -- for (i = 0; i < ARRAY_SIZE(buf->dmas); i++) { -- if (buf->dmas[i].sg_cpu) -- dma_free_coherent(ici->v4l2_dev.dev, -- buf->dmas[i].sg_size, -- buf->dmas[i].sg_cpu, -- buf->dmas[i].sg_dma); -- buf->dmas[i].sg_cpu = NULL; -- } -- - buf->vb.state = VIDEOBUF_NEEDS_INIT; - } - -@@ -309,6 +304,27 @@ static int calculate_dma_sglen(struct scatterlist *sglist, int sglen, - return i + 1; - } - -+static void pxa_camera_dma_irq(int channel, struct pxa_camera_dev *pcdev, -+ enum pxa_camera_active_dma act_dma); -+ -+static void pxa_camera_dma_irq_y(int channel, void *data) -+{ -+ struct pxa_camera_dev *pcdev = data; -+ pxa_camera_dma_irq(channel, pcdev, DMA_Y); -+} -+ -+static void pxa_camera_dma_irq_u(int channel, void *data) -+{ -+ struct pxa_camera_dev *pcdev = data; -+ pxa_camera_dma_irq(channel, pcdev, DMA_U); -+} -+ -+static void pxa_camera_dma_irq_v(int channel, void *data) -+{ -+ struct pxa_camera_dev *pcdev = data; -+ pxa_camera_dma_irq(channel, pcdev, DMA_V); -+} -+ - /** - * pxa_init_dma_channel - init dma descriptors - * @pcdev: pxa camera device -@@ -332,61 +348,61 @@ static int pxa_init_dma_channel(struct pxa_camera_dev *pcdev, - struct scatterlist **sg_first, int *sg_first_ofs) - { - struct pxa_cam_dma *pxa_dma = &buf->dmas[channel]; -+ struct dma_chan *dma_chan = pcdev->dma_chans[channel]; - struct device *dev = pcdev->soc_host.v4l2_dev.dev; - struct scatterlist *sg; -- int i, offset, sglen; -+ int ret, i, offset, sglen; - int dma_len = 0, xfer_len = 0; -+ struct dma_slave_config config; -+ struct dma_async_tx_descriptor *tx; - -- if (pxa_dma->sg_cpu) -- dma_free_coherent(dev, pxa_dma->sg_size, -- pxa_dma->sg_cpu, pxa_dma->sg_dma); -+ dmaengine_terminate_all(dma_chan); - - sglen = calculate_dma_sglen(*sg_first, dma->sglen, - *sg_first_ofs, size); - -- pxa_dma->sg_size = (sglen + 1) * sizeof(struct pxa_dma_desc); -- pxa_dma->sg_cpu = dma_alloc_coherent(dev, pxa_dma->sg_size, -- &pxa_dma->sg_dma, GFP_KERNEL); -- if (!pxa_dma->sg_cpu) -- return -ENOMEM; -- - pxa_dma->sglen = sglen; - offset = *sg_first_ofs; - - dev_dbg(dev, "DMA: sg_first=%p, sglen=%d, ofs=%d, dma.desc=%x\n", - *sg_first, sglen, *sg_first_ofs, pxa_dma->sg_dma); - -+ memset(&config, 0, sizeof(config)); -+ config.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; /* FIXME? */ -+ config.src_maxburst = 8; -+ config.src_addr = pcdev->res->start + cibr; -+ config.direction = DMA_DEV_TO_MEM; - -- for_each_sg(*sg_first, sg, sglen, i) { -- dma_len = sg_dma_len(sg); -- -- /* PXA27x Developer's Manual 27.4.4.1: round up to 8 bytes */ -- xfer_len = roundup(min(dma_len - offset, size), 8); -- -- size = max(0, size - xfer_len); -+ ret = dmaengine_slave_config(dma_chan, &config); -+ if (ret < 0) { -+ printk("%s(): dma slave config failed: %d\n", __func__, ret); -+ return ret; -+ } - -- pxa_dma->sg_cpu[i].dsadr = pcdev->res->start + cibr; -- pxa_dma->sg_cpu[i].dtadr = sg_dma_address(sg) + offset; -- pxa_dma->sg_cpu[i].dcmd = -- DCMD_FLOWSRC | DCMD_BURST8 | DCMD_INCTRGADDR | xfer_len; --#ifdef DEBUG -- if (!i) -- pxa_dma->sg_cpu[i].dcmd |= DCMD_STARTIRQEN; --#endif -- pxa_dma->sg_cpu[i].ddadr = -- pxa_dma->sg_dma + (i + 1) * sizeof(struct pxa_dma_desc); -+ pcdev->dma_len = dma_map_sg(dma_chan->device->dev, *sg_first, sg_len, -+ DMA_FROM_DEVICE); - -- dev_vdbg(dev, "DMA: desc.%08x->@phys=0x%08x, len=%d\n", -- pxa_dma->sg_dma + i * sizeof(struct pxa_dma_desc), -- sg_dma_address(sg) + offset, xfer_len); -- offset = 0; -+ tx = dmaengine_prep_slave_sg(chan, *sg_first, pcdev->dma_len, -+ config.direction, -+ DMA_PREP_INTERRUPT | DMA_CTRL_ACK); -+ if (!tx) { -+ printk("%s(): prep_slave_sg() failed\n", __func__, ret); -+ return; -+ } - -- if (size == 0) -- break; -+ switch (channel) { -+ case 0: -+ tx->callback = pxa_camera_dma_irq_y; -+ break; -+ case 1: -+ tx->callback = pxa_camera_dma_irq_u; -+ break; -+ case 2: -+ tx->callback = pxa_camera_dma_irq_v; -+ break; - } - -- pxa_dma->sg_cpu[sglen].ddadr = DDADR_STOP; -- pxa_dma->sg_cpu[sglen].dcmd = DCMD_FLOWSRC | DCMD_BURST8 | DCMD_ENDIRQEN; -+ tx->callback_param = pcdev; - - /* - * Handle 1 special case : -@@ -395,14 +411,16 @@ static int pxa_init_dma_channel(struct pxa_camera_dev *pcdev, - * for next plane should be the next after the last used to store the - * last scatter gather RAM page - */ -- if (xfer_len >= dma_len) { -- *sg_first_ofs = xfer_len - dma_len; -+ if (xfer_len >= pcdev->dma_len) { -+ *sg_first_ofs = xfer_len - pcdev->dma_len; - *sg_first = sg_next(sg); - } else { - *sg_first_ofs = xfer_len; - *sg_first = sg; - } - -+ dmaengine_submit(tx); -+ - return 0; - } - -@@ -524,11 +542,7 @@ static int pxa_videobuf_prepare(struct videobuf_queue *vq, - return 0; - - fail_v: -- dma_free_coherent(dev, buf->dmas[1].sg_size, -- buf->dmas[1].sg_cpu, buf->dmas[1].sg_dma); - fail_u: -- dma_free_coherent(dev, buf->dmas[0].sg_size, -- buf->dmas[0].sg_cpu, buf->dmas[0].sg_dma); - fail: - free_buffer(vq, buf); - out: -@@ -552,10 +566,8 @@ static void pxa_dma_start_channels(struct pxa_camera_dev *pcdev) - - for (i = 0; i < pcdev->channels; i++) { - dev_dbg(pcdev->soc_host.v4l2_dev.dev, -- "%s (channel=%d) ddadr=%08x\n", __func__, -- i, active->dmas[i].sg_dma); -- DDADR(pcdev->dma_chans[i]) = active->dmas[i].sg_dma; -- DCSR(pcdev->dma_chans[i]) = DCSR_RUN; -+ "%s (channel=%d)\n", __func__, i); -+ dma_async_issue_pending(pcdev->dma_chans[i]); - } - } - -@@ -566,7 +578,7 @@ static void pxa_dma_stop_channels(struct pxa_camera_dev *pcdev) - for (i = 0; i < pcdev->channels; i++) { - dev_dbg(pcdev->soc_host.v4l2_dev.dev, - "%s (channel=%d)\n", __func__, i); -- DCSR(pcdev->dma_chans[i]) = 0; -+ dmaengine_terminate_all(pcdev->dma_chans[i]); - } - } - -@@ -739,25 +751,13 @@ static void pxa_camera_dma_irq(int channel, struct pxa_camera_dev *pcdev, - - spin_lock_irqsave(&pcdev->lock, flags); - -- status = DCSR(channel); -- DCSR(channel) = status; -+/* FIXME: dma_unmap_sg() */ - - camera_status = __raw_readl(pcdev->base + CISR); - overrun = CISR_IFO_0; - if (pcdev->channels == 3) - overrun |= CISR_IFO_1 | CISR_IFO_2; - -- if (status & DCSR_BUSERR) { -- dev_err(dev, "DMA Bus Error IRQ!\n"); -- goto out; -- } -- -- if (!(status & (DCSR_ENDINTR | DCSR_STARTINTR))) { -- dev_err(dev, "Unknown DMA IRQ source, status: 0x%08x\n", -- status); -- goto out; -- } -- - /* - * pcdev->active should not be NULL in DMA irq handler. - * -@@ -777,52 +777,28 @@ static void pxa_camera_dma_irq(int channel, struct pxa_camera_dev *pcdev, - buf = container_of(vb, struct pxa_buffer, vb); - WARN_ON(buf->inwork || list_empty(&vb->queue)); - -- dev_dbg(dev, "%s channel=%d %s%s(vb=0x%p) dma.desc=%x\n", -- __func__, channel, status & DCSR_STARTINTR ? "SOF " : "", -- status & DCSR_ENDINTR ? "EOF " : "", vb, DDADR(channel)); -- -- if (status & DCSR_ENDINTR) { -- /* -- * It's normal if the last frame creates an overrun, as there -- * are no more DMA descriptors to fetch from QCI fifos -- */ -- if (camera_status & overrun && -- !list_is_last(pcdev->capture.next, &pcdev->capture)) { -- dev_dbg(dev, "FIFO overrun! CISR: %x\n", -- camera_status); -- pxa_camera_stop_capture(pcdev); -- pxa_camera_start_capture(pcdev); -- goto out; -- } -- buf->active_dma &= ~act_dma; -- if (!buf->active_dma) { -- pxa_camera_wakeup(pcdev, vb, buf); -- pxa_camera_check_link_miss(pcdev); -- } -+ /* -+ * It's normal if the last frame creates an overrun, as there -+ * are no more DMA descriptors to fetch from QCI fifos -+ */ -+ if (camera_status & overrun && -+ !list_is_last(pcdev->capture.next, &pcdev->capture)) { -+ dev_dbg(dev, "FIFO overrun! CISR: %x\n", -+ camera_status); -+ pxa_camera_stop_capture(pcdev); -+ pxa_camera_start_capture(pcdev); -+ goto out; -+ } -+ buf->active_dma &= ~act_dma; -+ if (!buf->active_dma) { -+ pxa_camera_wakeup(pcdev, vb, buf); -+ pxa_camera_check_link_miss(pcdev); - } - - out: - spin_unlock_irqrestore(&pcdev->lock, flags); - } - --static void pxa_camera_dma_irq_y(int channel, void *data) --{ -- struct pxa_camera_dev *pcdev = data; -- pxa_camera_dma_irq(channel, pcdev, DMA_Y); --} -- --static void pxa_camera_dma_irq_u(int channel, void *data) --{ -- struct pxa_camera_dev *pcdev = data; -- pxa_camera_dma_irq(channel, pcdev, DMA_U); --} -- --static void pxa_camera_dma_irq_v(int channel, void *data) --{ -- struct pxa_camera_dev *pcdev = data; -- pxa_camera_dma_irq(channel, pcdev, DMA_V); --} -- - static struct videobuf_queue_ops pxa_videobuf_ops = { - .buf_setup = pxa_videobuf_setup, - .buf_prepare = pxa_videobuf_prepare, -@@ -1655,6 +1631,7 @@ static int pxa_camera_probe(struct platform_device *pdev) - struct pxa_camera_dev *pcdev; - struct resource *res; - void __iomem *base; -+ unsigned int drcmr; - int irq; - int err = 0; - -@@ -1717,36 +1694,35 @@ static int pxa_camera_probe(struct platform_device *pdev) - pcdev->base = base; - - /* request dma */ -- err = pxa_request_dma("CI_Y", DMA_PRIO_HIGH, -- pxa_camera_dma_irq_y, pcdev); -- if (err < 0) { -+ dma_cap_zero(mask); -+ dma_cap_set(DMA_SLAVE, mask); -+ -+ drcmr = 68; -+ pcdev->dma_chans[0] = -+ dma_request_slave_channel_compat(mask, mmp_pdma_filter_fn, -+ &drcmr, &pdev->dev, "CI_Y"); -+ if (!pcdev->dma_chans[0]) { - dev_err(&pdev->dev, "Can't request DMA for Y\n"); -- return err; -+ return -ENODEV; - } -- pcdev->dma_chans[0] = err; -- dev_dbg(&pdev->dev, "got DMA channel %d\n", pcdev->dma_chans[0]); - -- err = pxa_request_dma("CI_U", DMA_PRIO_HIGH, -- pxa_camera_dma_irq_u, pcdev); -- if (err < 0) { -- dev_err(&pdev->dev, "Can't request DMA for U\n"); -+ drcmr = 69; -+ pcdev->dma_chans[1] = -+ dma_request_slave_channel_compat(mask, mmp_pdma_filter_fn, -+ &drcmr, &pdev->dev, "CI_U"); -+ if (!pcdev->dma_chans[1]) { -+ dev_err(&pdev->dev, "Can't request DMA for Y\n"); - goto exit_free_dma_y; - } -- pcdev->dma_chans[1] = err; -- dev_dbg(&pdev->dev, "got DMA channel (U) %d\n", pcdev->dma_chans[1]); - -- err = pxa_request_dma("CI_V", DMA_PRIO_HIGH, -- pxa_camera_dma_irq_v, pcdev); -- if (err < 0) { -+ drcmr = 70; -+ pcdev->dma_chans[2] = -+ dma_request_slave_channel_compat(mask, mmp_pdma_filter_fn, -+ &drcmr, &pdev->dev, "CI_V"); -+ if (!pcdev->dma_chans[2]) { - dev_err(&pdev->dev, "Can't request DMA for V\n"); - goto exit_free_dma_u; - } -- pcdev->dma_chans[2] = err; -- dev_dbg(&pdev->dev, "got DMA channel (V) %d\n", pcdev->dma_chans[2]); -- -- DRCMR(68) = pcdev->dma_chans[0] | DRCMR_MAPVLD; -- DRCMR(69) = pcdev->dma_chans[1] | DRCMR_MAPVLD; -- DRCMR(70) = pcdev->dma_chans[2] | DRCMR_MAPVLD; - - /* request irq */ - err = devm_request_irq(&pdev->dev, pcdev->irq, pxa_camera_irq, 0, -@@ -1769,11 +1745,11 @@ static int pxa_camera_probe(struct platform_device *pdev) - return 0; - - exit_free_dma: -- pxa_free_dma(pcdev->dma_chans[2]); -+ dma_release_channel(dma_chans[2]); - exit_free_dma_u: -- pxa_free_dma(pcdev->dma_chans[1]); -+ dma_release_channel(dma_chans[1]); - exit_free_dma_y: -- pxa_free_dma(pcdev->dma_chans[0]); -+ dma_release_channel(dma_chans[0]); - return err; - } - -@@ -1783,9 +1759,13 @@ static int pxa_camera_remove(struct platform_device *pdev) - struct pxa_camera_dev *pcdev = container_of(soc_host, - struct pxa_camera_dev, soc_host); - -- pxa_free_dma(pcdev->dma_chans[0]); -- pxa_free_dma(pcdev->dma_chans[1]); -- pxa_free_dma(pcdev->dma_chans[2]); -+ dmaengine_terminate_all(dma_chans[0]); -+ dmaengine_terminate_all(dma_chans[1]); -+ dmaengine_terminate_all(dma_chans[2]); -+ -+ dma_release_channel(dma_chans[0]); -+ dma_release_channel(dma_chans[1]); -+ dma_release_channel(dma_chans[2]); - - soc_camera_host_unregister(soc_host); - --- -1.8.3.1 diff --git a/a/content_digest b/N1/content_digest index d5c279d..d9a6122 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -1,35 +1,10 @@ "ref\01375889649-14638-1-git-send-email-zonque@gmail.com\0" "ref\087zjsqzdg8.fsf@free.fr\0" - "From\0Daniel Mack <zonque@gmail.com>\0" - "Subject\0Re: [PATCH 00/20] ARM: pxa: move core and drivers to dmaengine\0" + "From\0zonque@gmail.com (Daniel Mack)\0" + "Subject\0[PATCH 00/20] ARM: pxa: move core and drivers to dmaengine\0" "Date\0Sat, 10 Aug 2013 12:56:19 +0200\0" - "To\0Robert Jarzmik <robert.jarzmik@free.fr>\0" - "Cc\0mark.rutland@arm.com" - s.neumann@raumfeld.com - linux-mtd@lists.infradead.org - haojian.zhuang@linaro.org - cxie4@marvell.com - lars@metafoo.de - nico@linaro.org - vinod.koul@intel.com - marek.vasut@gmail.com - ezequiel.garcia@free-electrons.com - rmk+kernel@arm.linux.org.uk - devicetree@vger.kernel.org - samuel@sortiz.org - arnd@arndb.de - broonie@kernel.org - mika.westerberg@linux.intel.com - linux-arm-kernel@lists.infradead.org - thomas.petazzoni@free-electrons.com - eric.y.miao@gmail.com - gregkh@linuxfoundation.org - davem@davemloft.net - sachin.kamat@linaro.org - kernel@pengutronix.de - djbw@fb.com - " g.liakhovetski@gmx.de\0" - "\01:1\0" + "To\0linux-arm-kernel@lists.infradead.org\0" + "\00:1\0" "b\0" "Hi Robert,\n" "\n" @@ -96,469 +71,14 @@ "\n" "\n" "Thanks,\n" - Daniel - "\01:2\0" - "fn\00001-drivers-media-platform-soc_camera-pxa_camera.c-DMAEN.patch\0" - "b\0" - ">From 8d7333689479640d2586358ffb8f4e1704e4b015 Mon Sep 17 00:00:00 2001\n" - "From: Daniel Mack <zonque@gmail.com>\n" - "Date: Sun, 4 Aug 2013 00:23:00 +0200\n" - "Subject: [PATCH] drivers/media/platform/soc_camera/pxa_camera.c DMAENGINE WIP\n" - "\n" - "---\n" - " drivers/media/platform/soc_camera/pxa_camera.c | 262 ++++++++++++-------------\n" - " 1 file changed, 121 insertions(+), 141 deletions(-)\n" - "\n" - "diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/soc_camera/pxa_camera.c\n" - "index d4df305..4dfd97f 100644\n" - "--- a/drivers/media/platform/soc_camera/pxa_camera.c\n" - "+++ b/drivers/media/platform/soc_camera/pxa_camera.c\n" - "@@ -28,6 +28,9 @@\n" - " #include <linux/clk.h>\n" - " #include <linux/sched.h>\n" - " #include <linux/slab.h>\n" - "+#include <linux/dmaengine.h>\n" - "+#include <linux/dma-mapping.h>\n" - "+#include <linux/dma/mmp-pdma.h>\n" - " \n" - " #include <media/v4l2-common.h>\n" - " #include <media/v4l2-dev.h>\n" - "@@ -37,7 +40,6 @@\n" - " \n" - " #include <linux/videodev2.h>\n" - " \n" - "-#include <mach/dma.h>\n" - " #include <linux/platform_data/camera-pxa.h>\n" - " \n" - " #define PXA_CAM_VERSION \"0.0.6\"\n" - "@@ -177,8 +179,6 @@ enum pxa_camera_active_dma {\n" - " /* descriptor needed for the PXA DMA engine */\n" - " struct pxa_cam_dma {\n" - " \tdma_addr_t\t\tsg_dma;\n" - "-\tstruct pxa_dma_desc\t*sg_cpu;\n" - "-\tsize_t\t\t\tsg_size;\n" - " \tint\t\t\tsglen;\n" - " };\n" - " \n" - "@@ -206,7 +206,8 @@ struct pxa_camera_dev {\n" - " \tvoid __iomem\t\t*base;\n" - " \n" - " \tint\t\t\tchannels;\n" - "-\tunsigned int\t\tdma_chans[3];\n" - "+\tstruct dma_chan\t\t*dma_chans[3];\n" - "+\tunsigned int\t\tdma_len;\n" - " \n" - " \tstruct pxacamera_platform_data *pdata;\n" - " \tstruct resource\t\t*res;\n" - "@@ -257,15 +258,18 @@ static int pxa_videobuf_setup(struct videobuf_queue *vq, unsigned int *count,\n" - " static void free_buffer(struct videobuf_queue *vq, struct pxa_buffer *buf)\n" - " {\n" - " \tstruct soc_camera_device *icd = vq->priv_data;\n" - "-\tstruct soc_camera_host *ici = to_soc_camera_host(icd->parent);\n" - " \tstruct videobuf_dmabuf *dma = videobuf_to_dma(&buf->vb);\n" - "-\tint i;\n" - " \n" - " \tBUG_ON(in_interrupt());\n" - " \n" - " \tdev_dbg(icd->parent, \"%s (vb=0x%p) 0x%08lx %d\\n\", __func__,\n" - " \t\t&buf->vb, buf->vb.baddr, buf->vb.bsize);\n" - " \n" - "+\t/* FIXME */\n" - "+\tdmaengine_terminate_all(NULL);\n" - "+\tdmaengine_terminate_all(NULL);\n" - "+\tdmaengine_terminate_all(NULL);\n" - "+\n" - " \t/*\n" - " \t * This waits until this buffer is out of danger, i.e., until it is no\n" - " \t * longer in STATE_QUEUED or STATE_ACTIVE\n" - "@@ -274,15 +278,6 @@ static void free_buffer(struct videobuf_queue *vq, struct pxa_buffer *buf)\n" - " \tvideobuf_dma_unmap(vq->dev, dma);\n" - " \tvideobuf_dma_free(dma);\n" - " \n" - "-\tfor (i = 0; i < ARRAY_SIZE(buf->dmas); i++) {\n" - "-\t\tif (buf->dmas[i].sg_cpu)\n" - "-\t\t\tdma_free_coherent(ici->v4l2_dev.dev,\n" - "-\t\t\t\t\t buf->dmas[i].sg_size,\n" - "-\t\t\t\t\t buf->dmas[i].sg_cpu,\n" - "-\t\t\t\t\t buf->dmas[i].sg_dma);\n" - "-\t\tbuf->dmas[i].sg_cpu = NULL;\n" - "-\t}\n" - "-\n" - " \tbuf->vb.state = VIDEOBUF_NEEDS_INIT;\n" - " }\n" - " \n" - "@@ -309,6 +304,27 @@ static int calculate_dma_sglen(struct scatterlist *sglist, int sglen,\n" - " \treturn i + 1;\n" - " }\n" - " \n" - "+static void pxa_camera_dma_irq(int channel, struct pxa_camera_dev *pcdev,\n" - "+\t\t\t enum pxa_camera_active_dma act_dma);\n" - "+\n" - "+static void pxa_camera_dma_irq_y(int channel, void *data)\n" - "+{\n" - "+\tstruct pxa_camera_dev *pcdev = data;\n" - "+\tpxa_camera_dma_irq(channel, pcdev, DMA_Y);\n" - "+}\n" - "+\n" - "+static void pxa_camera_dma_irq_u(int channel, void *data)\n" - "+{\n" - "+\tstruct pxa_camera_dev *pcdev = data;\n" - "+\tpxa_camera_dma_irq(channel, pcdev, DMA_U);\n" - "+}\n" - "+\n" - "+static void pxa_camera_dma_irq_v(int channel, void *data)\n" - "+{\n" - "+\tstruct pxa_camera_dev *pcdev = data;\n" - "+\tpxa_camera_dma_irq(channel, pcdev, DMA_V);\n" - "+}\n" - "+\n" - " /**\n" - " * pxa_init_dma_channel - init dma descriptors\n" - " * @pcdev: pxa camera device\n" - "@@ -332,61 +348,61 @@ static int pxa_init_dma_channel(struct pxa_camera_dev *pcdev,\n" - " \t\t\t\tstruct scatterlist **sg_first, int *sg_first_ofs)\n" - " {\n" - " \tstruct pxa_cam_dma *pxa_dma = &buf->dmas[channel];\n" - "+\tstruct dma_chan *dma_chan = pcdev->dma_chans[channel];\n" - " \tstruct device *dev = pcdev->soc_host.v4l2_dev.dev;\n" - " \tstruct scatterlist *sg;\n" - "-\tint i, offset, sglen;\n" - "+\tint ret, i, offset, sglen;\n" - " \tint dma_len = 0, xfer_len = 0;\n" - "+\tstruct dma_slave_config config;\n" - "+\tstruct dma_async_tx_descriptor *tx;\n" - " \n" - "-\tif (pxa_dma->sg_cpu)\n" - "-\t\tdma_free_coherent(dev, pxa_dma->sg_size,\n" - "-\t\t\t\t pxa_dma->sg_cpu, pxa_dma->sg_dma);\n" - "+\tdmaengine_terminate_all(dma_chan);\n" - " \n" - " \tsglen = calculate_dma_sglen(*sg_first, dma->sglen,\n" - " \t\t\t\t *sg_first_ofs, size);\n" - " \n" - "-\tpxa_dma->sg_size = (sglen + 1) * sizeof(struct pxa_dma_desc);\n" - "-\tpxa_dma->sg_cpu = dma_alloc_coherent(dev, pxa_dma->sg_size,\n" - "-\t\t\t\t\t &pxa_dma->sg_dma, GFP_KERNEL);\n" - "-\tif (!pxa_dma->sg_cpu)\n" - "-\t\treturn -ENOMEM;\n" - "-\n" - " \tpxa_dma->sglen = sglen;\n" - " \toffset = *sg_first_ofs;\n" - " \n" - " \tdev_dbg(dev, \"DMA: sg_first=%p, sglen=%d, ofs=%d, dma.desc=%x\\n\",\n" - " \t\t*sg_first, sglen, *sg_first_ofs, pxa_dma->sg_dma);\n" - " \n" - "+\tmemset(&config, 0, sizeof(config));\n" - "+\tconfig.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; /* FIXME? */\n" - "+\tconfig.src_maxburst = 8;\n" - "+\tconfig.src_addr = pcdev->res->start + cibr;\n" - "+\tconfig.direction = DMA_DEV_TO_MEM;\n" - " \n" - "-\tfor_each_sg(*sg_first, sg, sglen, i) {\n" - "-\t\tdma_len = sg_dma_len(sg);\n" - "-\n" - "-\t\t/* PXA27x Developer's Manual 27.4.4.1: round up to 8 bytes */\n" - "-\t\txfer_len = roundup(min(dma_len - offset, size), 8);\n" - "-\n" - "-\t\tsize = max(0, size - xfer_len);\n" - "+\tret = dmaengine_slave_config(dma_chan, &config);\n" - "+\tif (ret < 0) {\n" - "+\t\tprintk(\"%s(): dma slave config failed: %d\\n\", __func__, ret);\n" - "+\t\treturn ret;\n" - "+\t}\n" - " \n" - "-\t\tpxa_dma->sg_cpu[i].dsadr = pcdev->res->start + cibr;\n" - "-\t\tpxa_dma->sg_cpu[i].dtadr = sg_dma_address(sg) + offset;\n" - "-\t\tpxa_dma->sg_cpu[i].dcmd =\n" - "-\t\t\tDCMD_FLOWSRC | DCMD_BURST8 | DCMD_INCTRGADDR | xfer_len;\n" - "-#ifdef DEBUG\n" - "-\t\tif (!i)\n" - "-\t\t\tpxa_dma->sg_cpu[i].dcmd |= DCMD_STARTIRQEN;\n" - "-#endif\n" - "-\t\tpxa_dma->sg_cpu[i].ddadr =\n" - "-\t\t\tpxa_dma->sg_dma + (i + 1) * sizeof(struct pxa_dma_desc);\n" - "+\tpcdev->dma_len = dma_map_sg(dma_chan->device->dev, *sg_first, sg_len,\n" - "+\t\t\t\t DMA_FROM_DEVICE);\n" - " \n" - "-\t\tdev_vdbg(dev, \"DMA: desc.%08x->@phys=0x%08x, len=%d\\n\",\n" - "-\t\t\t pxa_dma->sg_dma + i * sizeof(struct pxa_dma_desc),\n" - "-\t\t\t sg_dma_address(sg) + offset, xfer_len);\n" - "-\t\toffset = 0;\n" - "+\ttx = dmaengine_prep_slave_sg(chan, *sg_first, pcdev->dma_len,\n" - "+\t\t\t\t config.direction,\n" - "+\t\t\t\t DMA_PREP_INTERRUPT | DMA_CTRL_ACK);\n" - "+\tif (!tx) {\n" - "+\t\tprintk(\"%s(): prep_slave_sg() failed\\n\", __func__, ret);\n" - "+\t\treturn;\n" - "+\t}\n" - " \n" - "-\t\tif (size == 0)\n" - "-\t\t\tbreak;\n" - "+\tswitch (channel) {\n" - "+\tcase 0:\n" - "+\t\ttx->callback = pxa_camera_dma_irq_y;\n" - "+\t\tbreak;\n" - "+\tcase 1:\n" - "+\t\ttx->callback = pxa_camera_dma_irq_u;\n" - "+\t\tbreak;\n" - "+\tcase 2:\n" - "+\t\ttx->callback = pxa_camera_dma_irq_v;\n" - "+\t\tbreak;\n" - " \t}\n" - " \n" - "-\tpxa_dma->sg_cpu[sglen].ddadr = DDADR_STOP;\n" - "-\tpxa_dma->sg_cpu[sglen].dcmd = DCMD_FLOWSRC | DCMD_BURST8 | DCMD_ENDIRQEN;\n" - "+\ttx->callback_param = pcdev;\n" - " \n" - " \t/*\n" - " \t * Handle 1 special case :\n" - "@@ -395,14 +411,16 @@ static int pxa_init_dma_channel(struct pxa_camera_dev *pcdev,\n" - " \t * for next plane should be the next after the last used to store the\n" - " \t * last scatter gather RAM page\n" - " \t */\n" - "-\tif (xfer_len >= dma_len) {\n" - "-\t\t*sg_first_ofs = xfer_len - dma_len;\n" - "+\tif (xfer_len >= pcdev->dma_len) {\n" - "+\t\t*sg_first_ofs = xfer_len - pcdev->dma_len;\n" - " \t\t*sg_first = sg_next(sg);\n" - " \t} else {\n" - " \t\t*sg_first_ofs = xfer_len;\n" - " \t\t*sg_first = sg;\n" - " \t}\n" - " \n" - "+\tdmaengine_submit(tx);\n" - "+\n" - " \treturn 0;\n" - " }\n" - " \n" - "@@ -524,11 +542,7 @@ static int pxa_videobuf_prepare(struct videobuf_queue *vq,\n" - " \treturn 0;\n" - " \n" - " fail_v:\n" - "-\tdma_free_coherent(dev, buf->dmas[1].sg_size,\n" - "-\t\t\t buf->dmas[1].sg_cpu, buf->dmas[1].sg_dma);\n" - " fail_u:\n" - "-\tdma_free_coherent(dev, buf->dmas[0].sg_size,\n" - "-\t\t\t buf->dmas[0].sg_cpu, buf->dmas[0].sg_dma);\n" - " fail:\n" - " \tfree_buffer(vq, buf);\n" - " out:\n" - "@@ -552,10 +566,8 @@ static void pxa_dma_start_channels(struct pxa_camera_dev *pcdev)\n" - " \n" - " \tfor (i = 0; i < pcdev->channels; i++) {\n" - " \t\tdev_dbg(pcdev->soc_host.v4l2_dev.dev,\n" - "-\t\t\t\"%s (channel=%d) ddadr=%08x\\n\", __func__,\n" - "-\t\t\ti, active->dmas[i].sg_dma);\n" - "-\t\tDDADR(pcdev->dma_chans[i]) = active->dmas[i].sg_dma;\n" - "-\t\tDCSR(pcdev->dma_chans[i]) = DCSR_RUN;\n" - "+\t\t\t\"%s (channel=%d)\\n\", __func__, i);\n" - "+\t\tdma_async_issue_pending(pcdev->dma_chans[i]);\n" - " \t}\n" - " }\n" - " \n" - "@@ -566,7 +578,7 @@ static void pxa_dma_stop_channels(struct pxa_camera_dev *pcdev)\n" - " \tfor (i = 0; i < pcdev->channels; i++) {\n" - " \t\tdev_dbg(pcdev->soc_host.v4l2_dev.dev,\n" - " \t\t\t\"%s (channel=%d)\\n\", __func__, i);\n" - "-\t\tDCSR(pcdev->dma_chans[i]) = 0;\n" - "+\t\tdmaengine_terminate_all(pcdev->dma_chans[i]);\n" - " \t}\n" - " }\n" - " \n" - "@@ -739,25 +751,13 @@ static void pxa_camera_dma_irq(int channel, struct pxa_camera_dev *pcdev,\n" - " \n" - " \tspin_lock_irqsave(&pcdev->lock, flags);\n" - " \n" - "-\tstatus = DCSR(channel);\n" - "-\tDCSR(channel) = status;\n" - "+/* FIXME: dma_unmap_sg() */\n" - " \n" - " \tcamera_status = __raw_readl(pcdev->base + CISR);\n" - " \toverrun = CISR_IFO_0;\n" - " \tif (pcdev->channels == 3)\n" - " \t\toverrun |= CISR_IFO_1 | CISR_IFO_2;\n" - " \n" - "-\tif (status & DCSR_BUSERR) {\n" - "-\t\tdev_err(dev, \"DMA Bus Error IRQ!\\n\");\n" - "-\t\tgoto out;\n" - "-\t}\n" - "-\n" - "-\tif (!(status & (DCSR_ENDINTR | DCSR_STARTINTR))) {\n" - "-\t\tdev_err(dev, \"Unknown DMA IRQ source, status: 0x%08x\\n\",\n" - "-\t\t\tstatus);\n" - "-\t\tgoto out;\n" - "-\t}\n" - "-\n" - " \t/*\n" - " \t * pcdev->active should not be NULL in DMA irq handler.\n" - " \t *\n" - "@@ -777,52 +777,28 @@ static void pxa_camera_dma_irq(int channel, struct pxa_camera_dev *pcdev,\n" - " \tbuf = container_of(vb, struct pxa_buffer, vb);\n" - " \tWARN_ON(buf->inwork || list_empty(&vb->queue));\n" - " \n" - "-\tdev_dbg(dev, \"%s channel=%d %s%s(vb=0x%p) dma.desc=%x\\n\",\n" - "-\t\t__func__, channel, status & DCSR_STARTINTR ? \"SOF \" : \"\",\n" - "-\t\tstatus & DCSR_ENDINTR ? \"EOF \" : \"\", vb, DDADR(channel));\n" - "-\n" - "-\tif (status & DCSR_ENDINTR) {\n" - "-\t\t/*\n" - "-\t\t * It's normal if the last frame creates an overrun, as there\n" - "-\t\t * are no more DMA descriptors to fetch from QCI fifos\n" - "-\t\t */\n" - "-\t\tif (camera_status & overrun &&\n" - "-\t\t !list_is_last(pcdev->capture.next, &pcdev->capture)) {\n" - "-\t\t\tdev_dbg(dev, \"FIFO overrun! CISR: %x\\n\",\n" - "-\t\t\t\tcamera_status);\n" - "-\t\t\tpxa_camera_stop_capture(pcdev);\n" - "-\t\t\tpxa_camera_start_capture(pcdev);\n" - "-\t\t\tgoto out;\n" - "-\t\t}\n" - "-\t\tbuf->active_dma &= ~act_dma;\n" - "-\t\tif (!buf->active_dma) {\n" - "-\t\t\tpxa_camera_wakeup(pcdev, vb, buf);\n" - "-\t\t\tpxa_camera_check_link_miss(pcdev);\n" - "-\t\t}\n" - "+\t/*\n" - "+\t * It's normal if the last frame creates an overrun, as there\n" - "+\t * are no more DMA descriptors to fetch from QCI fifos\n" - "+\t */\n" - "+\tif (camera_status & overrun &&\n" - "+\t !list_is_last(pcdev->capture.next, &pcdev->capture)) {\n" - "+\t\tdev_dbg(dev, \"FIFO overrun! CISR: %x\\n\",\n" - "+\t\t\tcamera_status);\n" - "+\t\tpxa_camera_stop_capture(pcdev);\n" - "+\t\tpxa_camera_start_capture(pcdev);\n" - "+\t\tgoto out;\n" - "+\t}\n" - "+\tbuf->active_dma &= ~act_dma;\n" - "+\tif (!buf->active_dma) {\n" - "+\t\tpxa_camera_wakeup(pcdev, vb, buf);\n" - "+\t\tpxa_camera_check_link_miss(pcdev);\n" - " \t}\n" - " \n" - " out:\n" - " \tspin_unlock_irqrestore(&pcdev->lock, flags);\n" - " }\n" - " \n" - "-static void pxa_camera_dma_irq_y(int channel, void *data)\n" - "-{\n" - "-\tstruct pxa_camera_dev *pcdev = data;\n" - "-\tpxa_camera_dma_irq(channel, pcdev, DMA_Y);\n" - "-}\n" - "-\n" - "-static void pxa_camera_dma_irq_u(int channel, void *data)\n" - "-{\n" - "-\tstruct pxa_camera_dev *pcdev = data;\n" - "-\tpxa_camera_dma_irq(channel, pcdev, DMA_U);\n" - "-}\n" - "-\n" - "-static void pxa_camera_dma_irq_v(int channel, void *data)\n" - "-{\n" - "-\tstruct pxa_camera_dev *pcdev = data;\n" - "-\tpxa_camera_dma_irq(channel, pcdev, DMA_V);\n" - "-}\n" - "-\n" - " static struct videobuf_queue_ops pxa_videobuf_ops = {\n" - " \t.buf_setup = pxa_videobuf_setup,\n" - " \t.buf_prepare = pxa_videobuf_prepare,\n" - "@@ -1655,6 +1631,7 @@ static int pxa_camera_probe(struct platform_device *pdev)\n" - " \tstruct pxa_camera_dev *pcdev;\n" - " \tstruct resource *res;\n" - " \tvoid __iomem *base;\n" - "+\tunsigned int drcmr;\n" - " \tint irq;\n" - " \tint err = 0;\n" - " \n" - "@@ -1717,36 +1694,35 @@ static int pxa_camera_probe(struct platform_device *pdev)\n" - " \tpcdev->base = base;\n" - " \n" - " \t/* request dma */\n" - "-\terr = pxa_request_dma(\"CI_Y\", DMA_PRIO_HIGH,\n" - "-\t\t\t pxa_camera_dma_irq_y, pcdev);\n" - "-\tif (err < 0) {\n" - "+\tdma_cap_zero(mask);\n" - "+\tdma_cap_set(DMA_SLAVE, mask);\n" - "+\n" - "+\tdrcmr = 68;\n" - "+\tpcdev->dma_chans[0] =\n" - "+\t\tdma_request_slave_channel_compat(mask, mmp_pdma_filter_fn,\n" - "+\t\t\t\t\t\t &drcmr, &pdev->dev, \"CI_Y\");\n" - "+\tif (!pcdev->dma_chans[0]) {\n" - " \t\tdev_err(&pdev->dev, \"Can't request DMA for Y\\n\");\n" - "-\t\treturn err;\n" - "+\t\treturn -ENODEV;\n" - " \t}\n" - "-\tpcdev->dma_chans[0] = err;\n" - "-\tdev_dbg(&pdev->dev, \"got DMA channel %d\\n\", pcdev->dma_chans[0]);\n" - " \n" - "-\terr = pxa_request_dma(\"CI_U\", DMA_PRIO_HIGH,\n" - "-\t\t\t pxa_camera_dma_irq_u, pcdev);\n" - "-\tif (err < 0) {\n" - "-\t\tdev_err(&pdev->dev, \"Can't request DMA for U\\n\");\n" - "+\tdrcmr = 69;\n" - "+\tpcdev->dma_chans[1] =\n" - "+\t\tdma_request_slave_channel_compat(mask, mmp_pdma_filter_fn,\n" - "+\t\t\t\t\t\t &drcmr, &pdev->dev, \"CI_U\");\n" - "+\tif (!pcdev->dma_chans[1]) {\n" - "+\t\tdev_err(&pdev->dev, \"Can't request DMA for Y\\n\");\n" - " \t\tgoto exit_free_dma_y;\n" - " \t}\n" - "-\tpcdev->dma_chans[1] = err;\n" - "-\tdev_dbg(&pdev->dev, \"got DMA channel (U) %d\\n\", pcdev->dma_chans[1]);\n" - " \n" - "-\terr = pxa_request_dma(\"CI_V\", DMA_PRIO_HIGH,\n" - "-\t\t\t pxa_camera_dma_irq_v, pcdev);\n" - "-\tif (err < 0) {\n" - "+\tdrcmr = 70;\n" - "+\tpcdev->dma_chans[2] =\n" - "+\t\tdma_request_slave_channel_compat(mask, mmp_pdma_filter_fn,\n" - "+\t\t\t\t\t\t &drcmr, &pdev->dev, \"CI_V\");\n" - "+\tif (!pcdev->dma_chans[2]) {\n" - " \t\tdev_err(&pdev->dev, \"Can't request DMA for V\\n\");\n" - " \t\tgoto exit_free_dma_u;\n" - " \t}\n" - "-\tpcdev->dma_chans[2] = err;\n" - "-\tdev_dbg(&pdev->dev, \"got DMA channel (V) %d\\n\", pcdev->dma_chans[2]);\n" - "-\n" - "-\tDRCMR(68) = pcdev->dma_chans[0] | DRCMR_MAPVLD;\n" - "-\tDRCMR(69) = pcdev->dma_chans[1] | DRCMR_MAPVLD;\n" - "-\tDRCMR(70) = pcdev->dma_chans[2] | DRCMR_MAPVLD;\n" - " \n" - " \t/* request irq */\n" - " \terr = devm_request_irq(&pdev->dev, pcdev->irq, pxa_camera_irq, 0,\n" - "@@ -1769,11 +1745,11 @@ static int pxa_camera_probe(struct platform_device *pdev)\n" - " \treturn 0;\n" - " \n" - " exit_free_dma:\n" - "-\tpxa_free_dma(pcdev->dma_chans[2]);\n" - "+\tdma_release_channel(dma_chans[2]);\n" - " exit_free_dma_u:\n" - "-\tpxa_free_dma(pcdev->dma_chans[1]);\n" - "+\tdma_release_channel(dma_chans[1]);\n" - " exit_free_dma_y:\n" - "-\tpxa_free_dma(pcdev->dma_chans[0]);\n" - "+\tdma_release_channel(dma_chans[0]);\n" - " \treturn err;\n" - " }\n" - " \n" - "@@ -1783,9 +1759,13 @@ static int pxa_camera_remove(struct platform_device *pdev)\n" - " \tstruct pxa_camera_dev *pcdev = container_of(soc_host,\n" - " \t\t\t\t\tstruct pxa_camera_dev, soc_host);\n" - " \n" - "-\tpxa_free_dma(pcdev->dma_chans[0]);\n" - "-\tpxa_free_dma(pcdev->dma_chans[1]);\n" - "-\tpxa_free_dma(pcdev->dma_chans[2]);\n" - "+\tdmaengine_terminate_all(dma_chans[0]);\n" - "+\tdmaengine_terminate_all(dma_chans[1]);\n" - "+\tdmaengine_terminate_all(dma_chans[2]);\n" - "+\n" - "+\tdma_release_channel(dma_chans[0]);\n" - "+\tdma_release_channel(dma_chans[1]);\n" - "+\tdma_release_channel(dma_chans[2]);\n" - " \n" - " \tsoc_camera_host_unregister(soc_host);\n" - " \n" - "-- \n" - 1.8.3.1 + "Daniel\n" + "\n" + "-------------- next part --------------\n" + "A non-text attachment was scrubbed...\n" + "Name: 0001-drivers-media-platform-soc_camera-pxa_camera.c-DMAEN.patch\n" + "Type: text/x-patch\n" + "Size: 13827 bytes\n" + "Desc: not available\n" + URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130810/d527dc67/attachment-0001.bin> -73cbbdb91e788037824b31ad88e6d7563b474f928beedf5adf85129d35dba01a +63a3a31337137f51f09e85f7c903f2f6e49dea23c70e5a6834c76efd42a171a7
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.