[PATCH] V4L: mx2_camera: remove unsupported i.MX27 DMA mode, make EMMA mandatory
From: Sascha Hauer s.ha...@pengutronix.de The i.MX27 DMA support was introduced with the initial commit of this driver and originally created by me. However, I never got this stable due to the racy DMA engine and used the EMMA engine instead. As the DMA support is most probably unused and broken in its current state, remove it. EMMA becomes the only supported mode on i.MX27. This also helps us get rid of another user of the legacy i.MX DMA support and remove the dependency on ARCH_MX* macros as these are scheduled for removal. Signed-off-by: Sascha Hauer s.ha...@pengutronix.de [g.liakhovet...@gmx.de: remove unused goto] Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- Sascha, I'd prefer to merge your two mx2_camera patches and additionally slightly improve it by removing a dangling goto. Please confirm, that you're ok with this version. Thanks Guennadi drivers/media/video/mx2_camera.c | 245 - 1 files changed, 27 insertions(+), 218 deletions(-) diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c index 04aab0c..f771f53 100644 --- a/drivers/media/video/mx2_camera.c +++ b/drivers/media/video/mx2_camera.c @@ -38,9 +38,6 @@ #include linux/videodev2.h #include mach/mx2_cam.h -#ifdef CONFIG_MACH_MX27 -#include mach/dma-mx1-mx2.h -#endif #include mach/hardware.h #include asm/dma.h @@ -206,8 +203,6 @@ #define PRP_INTR_LBOVF (1 7) #define PRP_INTR_CH2OVF(1 8) -#define mx27_camera_emma(pcdev)(cpu_is_mx27() pcdev-use_emma) - #define MAX_VIDEO_MEM 16 struct mx2_prp_cfg { @@ -250,8 +245,6 @@ struct mx2_camera_dev { struct mx2_buffer *fb1_active; struct mx2_buffer *fb2_active; - int use_emma; - u32 csicr1; void*discard_buffer; @@ -330,7 +323,7 @@ static void mx2_camera_deactivate(struct mx2_camera_dev *pcdev) clk_disable(pcdev-clk_csi); writel(0, pcdev-base_csi + CSICR1); - if (mx27_camera_emma(pcdev)) { + if (cpu_is_mx27()) { writel(0, pcdev-base_emma + PRP_CNTL); } else if (cpu_is_mx25()) { spin_lock_irqsave(pcdev-lock, flags); @@ -362,7 +355,7 @@ static int mx2_camera_add_device(struct soc_camera_device *icd) csicr1 = CSICR1_MCLKEN; - if (mx27_camera_emma(pcdev)) { + if (cpu_is_mx27()) { csicr1 |= CSICR1_PRP_IF_EN | CSICR1_FCC | CSICR1_RXFF_LEVEL(0); } else if (cpu_is_mx27()) @@ -402,42 +395,6 @@ static void mx2_camera_remove_device(struct soc_camera_device *icd) pcdev-icd = NULL; } -#ifdef CONFIG_MACH_MX27 -static void mx27_camera_dma_enable(struct mx2_camera_dev *pcdev) -{ - u32 tmp; - - imx_dma_enable(pcdev-dma); - - tmp = readl(pcdev-base_csi + CSICR1); - tmp |= CSICR1_RF_OR_INTEN; - writel(tmp, pcdev-base_csi + CSICR1); -} - -static irqreturn_t mx27_camera_irq(int irq_csi, void *data) -{ - struct mx2_camera_dev *pcdev = data; - u32 status = readl(pcdev-base_csi + CSISR); - - if (status CSISR_SOF_INT pcdev-active) { - u32 tmp; - - tmp = readl(pcdev-base_csi + CSICR1); - writel(tmp | CSICR1_CLR_RXFIFO, pcdev-base_csi + CSICR1); - mx27_camera_dma_enable(pcdev); - } - - writel(CSISR_SOF_INT | CSISR_RFF_OR_INT, pcdev-base_csi + CSISR); - - return IRQ_HANDLED; -} -#else -static irqreturn_t mx27_camera_irq(int irq_csi, void *data) -{ - return IRQ_NONE; -} -#endif /* CONFIG_MACH_MX27 */ - static void mx25_camera_frame_done(struct mx2_camera_dev *pcdev, int fb, int state) { @@ -617,28 +574,7 @@ static void mx2_videobuf_queue(struct videobuf_queue *vq, vb-state = VIDEOBUF_QUEUED; list_add_tail(vb-queue, pcdev-capture); - if (mx27_camera_emma(pcdev)) { - goto out; -#ifdef CONFIG_MACH_MX27 - } else if (cpu_is_mx27()) { - int ret; - - if (pcdev-active == NULL) { - ret = imx_dma_setup_single(pcdev-dma, - videobuf_to_dma_contig(vb), vb-size, - (u32)pcdev-base_dma + 0x10, - DMA_MODE_READ); - if (ret) { - vb-state = VIDEOBUF_ERROR; - wake_up(vb-done); - goto out; - } - - vb-state = VIDEOBUF_ACTIVE; - pcdev-active = buf; - } -#endif - } else { /* cpu_is_mx25() */ + if (cpu_is_mx25()) { u32 csicr3, dma_inten = 0; if (pcdev-fb1_active == NULL) { @@ -674,7 +610,6 @@ static void mx2_videobuf_queue(struct videobuf_queue *vq, }
Re: [PATCH] V4L: mx2_camera: remove unsupported i.MX27 DMA mode, make EMMA mandatory
On Mon, Feb 20, 2012 at 04:17:39PM +0100, Guennadi Liakhovetski wrote: From: Sascha Hauer s.ha...@pengutronix.de The i.MX27 DMA support was introduced with the initial commit of this driver and originally created by me. However, I never got this stable due to the racy DMA engine and used the EMMA engine instead. As the DMA support is most probably unused and broken in its current state, remove it. EMMA becomes the only supported mode on i.MX27. This also helps us get rid of another user of the legacy i.MX DMA support and remove the dependency on ARCH_MX* macros as these are scheduled for removal. Signed-off-by: Sascha Hauer s.ha...@pengutronix.de [g.liakhovet...@gmx.de: remove unused goto] Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- Sascha, I'd prefer to merge your two mx2_camera patches and additionally slightly improve it by removing a dangling goto. Please confirm, that you're ok with this version. Looks good. Acked-by: Sascha Hauer s.ha...@pengutronix.de Thanks Guennadi drivers/media/video/mx2_camera.c | 245 - 1 files changed, 27 insertions(+), 218 deletions(-) diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c index 04aab0c..f771f53 100644 --- a/drivers/media/video/mx2_camera.c +++ b/drivers/media/video/mx2_camera.c @@ -38,9 +38,6 @@ #include linux/videodev2.h #include mach/mx2_cam.h -#ifdef CONFIG_MACH_MX27 -#include mach/dma-mx1-mx2.h -#endif #include mach/hardware.h #include asm/dma.h @@ -206,8 +203,6 @@ #define PRP_INTR_LBOVF (1 7) #define PRP_INTR_CH2OVF (1 8) -#define mx27_camera_emma(pcdev) (cpu_is_mx27() pcdev-use_emma) - #define MAX_VIDEO_MEM16 struct mx2_prp_cfg { @@ -250,8 +245,6 @@ struct mx2_camera_dev { struct mx2_buffer *fb1_active; struct mx2_buffer *fb2_active; - int use_emma; - u32 csicr1; void*discard_buffer; @@ -330,7 +323,7 @@ static void mx2_camera_deactivate(struct mx2_camera_dev *pcdev) clk_disable(pcdev-clk_csi); writel(0, pcdev-base_csi + CSICR1); - if (mx27_camera_emma(pcdev)) { + if (cpu_is_mx27()) { writel(0, pcdev-base_emma + PRP_CNTL); } else if (cpu_is_mx25()) { spin_lock_irqsave(pcdev-lock, flags); @@ -362,7 +355,7 @@ static int mx2_camera_add_device(struct soc_camera_device *icd) csicr1 = CSICR1_MCLKEN; - if (mx27_camera_emma(pcdev)) { + if (cpu_is_mx27()) { csicr1 |= CSICR1_PRP_IF_EN | CSICR1_FCC | CSICR1_RXFF_LEVEL(0); } else if (cpu_is_mx27()) @@ -402,42 +395,6 @@ static void mx2_camera_remove_device(struct soc_camera_device *icd) pcdev-icd = NULL; } -#ifdef CONFIG_MACH_MX27 -static void mx27_camera_dma_enable(struct mx2_camera_dev *pcdev) -{ - u32 tmp; - - imx_dma_enable(pcdev-dma); - - tmp = readl(pcdev-base_csi + CSICR1); - tmp |= CSICR1_RF_OR_INTEN; - writel(tmp, pcdev-base_csi + CSICR1); -} - -static irqreturn_t mx27_camera_irq(int irq_csi, void *data) -{ - struct mx2_camera_dev *pcdev = data; - u32 status = readl(pcdev-base_csi + CSISR); - - if (status CSISR_SOF_INT pcdev-active) { - u32 tmp; - - tmp = readl(pcdev-base_csi + CSICR1); - writel(tmp | CSICR1_CLR_RXFIFO, pcdev-base_csi + CSICR1); - mx27_camera_dma_enable(pcdev); - } - - writel(CSISR_SOF_INT | CSISR_RFF_OR_INT, pcdev-base_csi + CSISR); - - return IRQ_HANDLED; -} -#else -static irqreturn_t mx27_camera_irq(int irq_csi, void *data) -{ - return IRQ_NONE; -} -#endif /* CONFIG_MACH_MX27 */ - static void mx25_camera_frame_done(struct mx2_camera_dev *pcdev, int fb, int state) { @@ -617,28 +574,7 @@ static void mx2_videobuf_queue(struct videobuf_queue *vq, vb-state = VIDEOBUF_QUEUED; list_add_tail(vb-queue, pcdev-capture); - if (mx27_camera_emma(pcdev)) { - goto out; -#ifdef CONFIG_MACH_MX27 - } else if (cpu_is_mx27()) { - int ret; - - if (pcdev-active == NULL) { - ret = imx_dma_setup_single(pcdev-dma, - videobuf_to_dma_contig(vb), vb-size, - (u32)pcdev-base_dma + 0x10, - DMA_MODE_READ); - if (ret) { - vb-state = VIDEOBUF_ERROR; - wake_up(vb-done); - goto out; - } - - vb-state = VIDEOBUF_ACTIVE; - pcdev-active = buf; - } -#endif - } else { /* cpu_is_mx25() */ + if (cpu_is_mx25()) {