Skip to contentSkip to conversation

Driver for the i.MX2x CMOS Sensor Interface

PATCH Superseded Baruch Siach 2 participants 8 messages May 26, 2010 – Jun 21, 2010

Subsystems (4)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v3 cover Driver for the i.MX2x CMOS Sensor Interface

This series contains a soc_camera driver for the i.MX25/i.MX27 CSI device, and platform code for the i.MX25 and i.MX27 chips. This driver is based on a driver for i.MX27 CSI from Sascha Hauer, that Alan Carvalho de Assis has posted in linux-media last December[1]. I tested the mx2_camera driver on the i.MX25 PDK. Sascha Hauer has tested a earlier version of this driver on an i.MX27 based board. I included in this version some fixes from Sascha that enable i.MX27 support.

[1] https://patchwork.kernel.org/patch/67636/

Changes v2 -> v3
Address more comments from Guennadi Liakhovetski.

Applied part of Sashca's patch that I forgot in v2.

Changes v1 -> v2
Addressed the comments of Guennadi Liakhovetski except from the following:

1. The mclk_get_divisor implementation, since I don't know what this code is good for

2. mx2_videobuf_release should not set pcdev->active on i.MX27, because mx27_camera_frame_done needs this pointer

3. In mx27_camera_emma_buf_init I don't know the meaning of those hard coded magic numbers

Applied i.MX27 fixes from Sascha.

Baruch Siach (3):
mx2_camera: Add soc_camera support for i.MX25/i.MX27
mx27: add support for the CSI device
mx25: add support for the CSI device

 arch/arm/mach-mx2/clock_imx27.c          |    2 +-
 arch/arm/mach-mx2/devices.c              |   31 +
 arch/arm/mach-mx2/devices.h              |    1 +
 arch/arm/mach-mx25/clock.c               |   14 +-
 arch/arm/mach-mx25/devices.c             |   22 +
 arch/arm/mach-mx25/devices.h             |    1 +
 arch/arm/plat-mxc/include/mach/memory.h  |    4 +-
 arch/arm/plat-mxc/include/mach/mx25.h    |    2 +
 arch/arm/plat-mxc/include/mach/mx2_cam.h |   46 +
 drivers/media/video/Kconfig              |   13 +
 drivers/media/video/Makefile             |    1 +
 drivers/media/video/mx2_camera.c         | 1488 ++++++++++++++++++++++++++++++
 12 files changed, 1620 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/plat-mxc/include/mach/mx2_cam.h
 create mode 100644 drivers/media/video/mx2_camera.c
#1 lore raw

PATCH v3 1/3 mx2_camera: Add soc_camera support for i.MX25/i.MX27

This is the soc_camera support developed by Sascha Hauer for the i.MX27. Alan Carvalho de Assis modified the original driver to get it working on more recent kernels. I modified it further to add support for i.MX25. This driver has been tested on i.MX25 and i.MX27 based platforms.

---
 arch/arm/plat-mxc/include/mach/memory.h  |    4 +-
 arch/arm/plat-mxc/include/mach/mx2_cam.h |   46 +
 drivers/media/video/Kconfig              |   13 +
 drivers/media/video/Makefile             |    1 +
 drivers/media/video/mx2_camera.c         | 1488 ++++++++++++++++++++++++++++++
 5 files changed, 1550 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/plat-mxc/include/mach/mx2_cam.h
 create mode 100644 drivers/media/video/mx2_camera.c
arch/arm/plat-mxc/include/mach/memory.h +2 -2
index c4b40c3..5803836 100644
@@ -44,12 +44,12 @@
  */
 #define CONSISTENT_DMA_SIZE SZ_8M
 
-#elif defined(CONFIG_MX1_VIDEO)
+#elif defined(CONFIG_MX1_VIDEO) || defined(CONFIG_MX2_VIDEO)
 /*
  * Increase size of DMA-consistent memory region.
  * This is required for i.MX camera driver to capture at least four VGA frames.
  */
 #define CONSISTENT_DMA_SIZE SZ_4M
-#endif /* CONFIG_MX1_VIDEO */
+#endif /* CONFIG_MX1_VIDEO || CONFIG_MX2_VIDEO */
 
 #endif /* __ASM_ARCH_MXC_MEMORY_H__ */
arch/arm/plat-mxc/include/mach/mx2_cam.h new file +46 -0

46 lines not on this page · raw message

drivers/media/video/Kconfig +13 -0
index 9644cf7..73b87a9 100644
@@ -949,6 +949,19 @@ config VIDEO_OMAP2
 	---help---
 	  This is a v4l2 driver for the TI OMAP2 camera capture interface
 
+config MX2_VIDEO
+        bool
+
+config VIDEO_MX2
+	tristate "i.MX27/i.MX25 Camera Sensor Interface driver"
+	depends on VIDEO_DEV && SOC_CAMERA && (MACH_MX27 || ARCH_MX25)
+	select VIDEOBUF_DMA_CONTIG
+	select MX2_VIDEO
+	---help---
+	  This is a v4l2 driver for the i.MX27 and the i.MX25 Camera Sensor
+	  Interface
+
+
 #
 # USB Multimedia device configuration
 #
drivers/media/video/Makefile +1 -0
index c51c386..72615fd 100644
@@ -156,6 +156,7 @@ obj-$(CONFIG_SOC_CAMERA)		+= soc_camera.o soc_mediabus.o
 obj-$(CONFIG_SOC_CAMERA_PLATFORM)	+= soc_camera_platform.o
 # soc-camera host drivers have to be linked after camera drivers
 obj-$(CONFIG_VIDEO_MX1)			+= mx1_camera.o
+obj-$(CONFIG_VIDEO_MX2)			+= mx2_camera.o
 obj-$(CONFIG_VIDEO_MX3)			+= mx3_camera.o
 obj-$(CONFIG_VIDEO_PXA27x)		+= pxa_camera.o
 obj-$(CONFIG_VIDEO_SH_MOBILE_CEU)	+= sh_mobile_ceu_camera.o
drivers/media/video/mx2_camera.c new file +1488 -0

1,488 lines not on this page · raw message

Signature · 1 line
1.7.1
#2 lore raw

PATCH v3 1/3 mx2_camera: Add soc_camera support for i.MX25/i.MX27

Hi Baruch

Quoted 4 lines · Baruch Siach

This is the soc_camera support developed by Sascha Hauer for the i.MX27. Alan Carvalho de Assis modified the original driver to get it working on more recent kernels. I modified it further to add support for i.MX25. This driver has been tested on i.MX25 and i.MX27 based platforms.

I hoped, this would be the final version, but if I'm not mistaken, you've introduced an error, which we better fix before committing. And as we anyway will likely need a v4, I'll also ask you to improve a couple of stylistic issues, which otherwise I'd just fix myself with your permission.

Quoted 15 lines
---
 arch/arm/plat-mxc/include/mach/memory.h  |    4 +-
 arch/arm/plat-mxc/include/mach/mx2_cam.h |   46 +
 drivers/media/video/Kconfig              |   13 +
 drivers/media/video/Makefile             |    1 +
 drivers/media/video/mx2_camera.c         | 1488 ++++++++++++++++++++++++++++++
 5 files changed, 1550 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/plat-mxc/include/mach/mx2_cam.h
 create mode 100644 drivers/media/video/mx2_camera.c
arch/arm/plat-mxc/include/mach/memory.h +0 -0
index c4b40c3..5803836 100644

[snip]

Quoted 12 lines
arch/arm/plat-mxc/include/mach/memory.h +12 -0
+static void mx2_videobuf_queue(struct videobuf_queue *vq,
+			       struct videobuf_buffer *vb)
+{
+	struct soc_camera_device *icd = vq->priv_data;
+	struct soc_camera_host *ici =
+		to_soc_camera_host(icd->dev.parent);
+	struct mx2_camera_dev *pcdev = ici->priv;
+	struct mx2_buffer *buf = container_of(vb, struct mx2_buffer, vb);
+	unsigned long flags;
+	int ret;
+
+	dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__,

arch/arm/plat-mxc/include/mach/memory.h

Quoted 10 lines
arch/arm/plat-mxc/include/mach/memory.h +10 -0
+		vb, vb->baddr, vb->bsize);
+
+	spin_lock_irqsave(&pcdev->lock, flags);
+
+	vb->state = VIDEOBUF_QUEUED;
+	list_add_tail(&vb->queue, &pcdev->capture);
+
+	if (mx27_camera_emma(pcdev))
+		goto out;
+	else if (cpu_is_mx27()) {

One of the minor ones - please, add braces in the "if" case.

[snip]

Quoted 10 lines
arch/arm/plat-mxc/include/mach/memory.h +10 -0
+static irqreturn_t mx27_camera_emma_irq(int irq_emma, void *data)
+{
+	struct mx2_camera_dev *pcdev = data;
+	unsigned int status = readl(pcdev->base_emma + PRP_INTRSTATUS);
+	struct mx2_buffer *buf;
+
+	if ((status & (3 << 5)) == (3 << 5)
+			&& !list_empty(&pcdev->active_bufs)) {
+		/*
+		 * Both buffers have triggered, process the one we're expecting

arch/arm/plat-mxc/include/mach/memory.h

Quoted 10 lines
arch/arm/plat-mxc/include/mach/memory.h +10 -0
+		 * to first
+		 */
+		buf = list_entry(pcdev->active_bufs.next,
+			struct mx2_buffer, vb.queue);
+		mx27_camera_frame_done_emma(pcdev, buf->bufnum, VIDEOBUF_DONE);
+	}
+	if (status & (1 << 6))
+		mx27_camera_frame_done_emma(pcdev, 0, VIDEOBUF_DONE);
+	if (status & (1 << 5))
+		mx27_camera_frame_done_emma(pcdev, 1, VIDEOBUF_DONE);

Now, this is the important one. In my review of v2 I proposed the above fix for the both-bits-set case. But, I think, your implementation is not correct. Don't you have to clear the expected buffer number, so that you don't process it twice? Something like

		status &= ~(1 << 6 - buf->bufnum);

anywhere inside the first of the three ifs?

arch/arm/plat-mxc/include/mach/memory.h

Quoted 1 line
arch/arm/plat-mxc/include/mach/memory.h +1 -0
+	if (status & (1 << 7)) {

Bit 7 is overflow. A correct handling could be resetting the buffer, returning an error frame and continuing with the next one. However, I understand, that you do not have a chance to implement this properly now. So, please, at least add a "FIXME" comment, explaining, what should be done here. Besides, error states are normally checked before normal data processing. So, either mention this in the comment too, or move this above the buffer completion processing.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#3 lore raw

PATCH v3 1/3 mx2_camera: Add soc_camera support for i.MX25/i.MX27

Hi Guennadi,

Quoted 6 lines · Guennadi Liakhovetski
Quoted 4 lines · Baruch Siach

This is the soc_camera support developed by Sascha Hauer for the i.MX27. Alan Carvalho de Assis modified the original driver to get it working on more recent kernels. I modified it further to add support for i.MX25. This driver has been tested on i.MX25 and i.MX27 based platforms.

Tanks for your review. I'll send v4 shortly.

baruch

Quoted 96 lines

I hoped, this would be the final version, but if I'm not mistaken, you've introduced an error, which we better fix before committing. And as we anyway will likely need a v4, I'll also ask you to improve a couple of stylistic issues, which otherwise I'd just fix myself with your permission.

Quoted 15 lines
---
 arch/arm/plat-mxc/include/mach/memory.h  |    4 +-
 arch/arm/plat-mxc/include/mach/mx2_cam.h |   46 +
 drivers/media/video/Kconfig              |   13 +
 drivers/media/video/Makefile             |    1 +
 drivers/media/video/mx2_camera.c         | 1488 ++++++++++++++++++++++++++++++
 5 files changed, 1550 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/plat-mxc/include/mach/mx2_cam.h
 create mode 100644 drivers/media/video/mx2_camera.c
arch/arm/plat-mxc/include/mach/memory.h +0 -0
index c4b40c3..5803836 100644

[snip]

Quoted 12 lines
arch/arm/plat-mxc/include/mach/memory.h +12 -0
+static void mx2_videobuf_queue(struct videobuf_queue *vq,
+			       struct videobuf_buffer *vb)
+{
+	struct soc_camera_device *icd = vq->priv_data;
+	struct soc_camera_host *ici =
+		to_soc_camera_host(icd->dev.parent);
+	struct mx2_camera_dev *pcdev = ici->priv;
+	struct mx2_buffer *buf = container_of(vb, struct mx2_buffer, vb);
+	unsigned long flags;
+	int ret;
+
+	dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__,

arch/arm/plat-mxc/include/mach/memory.h

Quoted 10 lines
arch/arm/plat-mxc/include/mach/memory.h +10 -0
+		vb, vb->baddr, vb->bsize);
+
+	spin_lock_irqsave(&pcdev->lock, flags);
+
+	vb->state = VIDEOBUF_QUEUED;
+	list_add_tail(&vb->queue, &pcdev->capture);
+
+	if (mx27_camera_emma(pcdev))
+		goto out;
+	else if (cpu_is_mx27()) {

One of the minor ones - please, add braces in the "if" case.

[snip]

Quoted 10 lines
arch/arm/plat-mxc/include/mach/memory.h +10 -0
+static irqreturn_t mx27_camera_emma_irq(int irq_emma, void *data)
+{
+	struct mx2_camera_dev *pcdev = data;
+	unsigned int status = readl(pcdev->base_emma + PRP_INTRSTATUS);
+	struct mx2_buffer *buf;
+
+	if ((status & (3 << 5)) == (3 << 5)
+			&& !list_empty(&pcdev->active_bufs)) {
+		/*
+		 * Both buffers have triggered, process the one we're expecting

arch/arm/plat-mxc/include/mach/memory.h

Quoted 10 lines
arch/arm/plat-mxc/include/mach/memory.h +10 -0
+		 * to first
+		 */
+		buf = list_entry(pcdev->active_bufs.next,
+			struct mx2_buffer, vb.queue);
+		mx27_camera_frame_done_emma(pcdev, buf->bufnum, VIDEOBUF_DONE);
+	}
+	if (status & (1 << 6))
+		mx27_camera_frame_done_emma(pcdev, 0, VIDEOBUF_DONE);
+	if (status & (1 << 5))
+		mx27_camera_frame_done_emma(pcdev, 1, VIDEOBUF_DONE);

Now, this is the important one. In my review of v2 I proposed the above fix for the both-bits-set case. But, I think, your implementation is not correct. Don't you have to clear the expected buffer number, so that you don't process it twice? Something like

		status &= ~(1 << 6 - buf->bufnum);

anywhere inside the first of the three ifs?

arch/arm/plat-mxc/include/mach/memory.h

Quoted 1 line
arch/arm/plat-mxc/include/mach/memory.h +1 -0
+	if (status & (1 << 7)) {

Bit 7 is overflow. A correct handling could be resetting the buffer, returning an error frame and continuing with the next one. However, I understand, that you do not have a chance to implement this properly now. So, please, at least add a "FIXME" comment, explaining, what should be done here. Besides, error states are normally checked before normal data processing. So, either mention this in the comment too, or move this above the buffer completion processing.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

Signature · 3 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#4 lore raw

PATCH v3 2/3 mx27: add support for the CSI device

In reply to Baruch Siach
---
 arch/arm/mach-mx2/clock_imx27.c |    2 +-
 arch/arm/mach-mx2/devices.c     |   31 +++++++++++++++++++++++++++++++
 arch/arm/mach-mx2/devices.h     |    1 +
 3 files changed, 33 insertions(+), 1 deletions(-)
arch/arm/mach-mx2/clock_imx27.c +1 -1
index 0f0823c..5a1aa15 100644
@@ -644,7 +644,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK("spi_imx.1", NULL, cspi2_clk)
 	_REGISTER_CLOCK("spi_imx.2", NULL, cspi3_clk)
 	_REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk)
-	_REGISTER_CLOCK(NULL, "csi", csi_clk)
+	_REGISTER_CLOCK("mx2-camera.0", NULL, csi_clk)
 	_REGISTER_CLOCK("fsl-usb2-udc", "usb", usb_clk)
 	_REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", usb_clk1)
 	_REGISTER_CLOCK("mxc-ehci.0", "usb", usb_clk)
arch/arm/mach-mx2/devices.c +31 -0
index b91e412..6a49c79 100644
@@ -40,6 +40,37 @@
 
 #include "devices.h"
 
+#ifdef CONFIG_MACH_MX27
+static struct resource mx27_camera_resources[] = {
+	{
+	       .start = MX27_CSI_BASE_ADDR,
+	       .end = MX27_CSI_BASE_ADDR + 0x1f,
+	       .flags = IORESOURCE_MEM,
+	}, {
+	       .start = MX27_EMMA_PRP_BASE_ADDR,
+	       .end = MX27_EMMA_PRP_BASE_ADDR + 0x1f,
+	       .flags = IORESOURCE_MEM,
+	}, {
+	       .start = MX27_INT_CSI,
+	       .end = MX27_INT_CSI,
+	       .flags = IORESOURCE_IRQ,
+	},{
+	       .start = MX27_INT_EMMAPRP,
+	       .end = MX27_INT_EMMAPRP,
+	       .flags = IORESOURCE_IRQ,
+	},
+};
+struct platform_device mx27_camera_device = {
+	.name = "mx2-camera",
+	.id = 0,
+	.num_resources = ARRAY_SIZE(mx27_camera_resources),
+	.resource = mx27_camera_resources,
+	.dev = {
+		.coherent_dma_mask = 0xffffffff,
+	},
+};
+#endif
+
 /*
  * SPI master controller
  *
arch/arm/mach-mx2/devices.h +1 -0
index 84ed513..8bdf018 100644
@@ -29,6 +29,7 @@ extern struct platform_device mxc_i2c_device1;
 extern struct platform_device mxc_sdhc_device0;
 extern struct platform_device mxc_sdhc_device1;
 extern struct platform_device mxc_otg_udc_device;
+extern struct platform_device mx27_camera_device;
 extern struct platform_device mxc_otg_host;
 extern struct platform_device mxc_usbh1;
 extern struct platform_device mxc_usbh2;
Signature · 1 line
1.7.1
#5 lore raw

PATCH v3 3/3 mx25: add support for the CSI device

In reply to Baruch Siach
---
 arch/arm/mach-mx25/clock.c            |   14 ++++++++++++--
 arch/arm/mach-mx25/devices.c          |   22 ++++++++++++++++++++++
 arch/arm/mach-mx25/devices.h          |    1 +
 arch/arm/plat-mxc/include/mach/mx25.h |    2 ++
 4 files changed, 37 insertions(+), 2 deletions(-)
arch/arm/mach-mx25/clock.c +12 -2
index 1550149..7a98d18 100644
@@ -129,6 +129,11 @@ static unsigned long get_rate_lcdc(struct clk *clk)
 	return get_rate_per(7);
 }
 
+static unsigned long get_rate_csi(struct clk *clk)
+{
+	return get_rate_per(0);
+}
+
 static unsigned long get_rate_otg(struct clk *clk)
 {
 	return 48000000; /* FIXME */
@@ -174,6 +179,8 @@ DEFINE_CLOCK(cspi3_clk,  0, CCM_CGCR1,  7, get_rate_ipg, NULL, NULL);
 DEFINE_CLOCK(fec_ahb_clk, 0, CCM_CGCR0, 23, NULL,	 NULL, NULL);
 DEFINE_CLOCK(lcdc_ahb_clk, 0, CCM_CGCR0, 24, NULL,	 NULL, NULL);
 DEFINE_CLOCK(lcdc_per_clk, 0, CCM_CGCR0,  7, NULL,	 NULL, &lcdc_ahb_clk);
+DEFINE_CLOCK(csi_ahb_clk, 0, CCM_CGCR0, 18, get_rate_csi, NULL, NULL);
+DEFINE_CLOCK(csi_per_clk, 0, CCM_CGCR0, 0, get_rate_csi, NULL, &csi_ahb_clk);
 DEFINE_CLOCK(uart1_clk,  0, CCM_CGCR2, 14, get_rate_uart, NULL, &uart_per_clk);
 DEFINE_CLOCK(uart2_clk,  0, CCM_CGCR2, 15, get_rate_uart, NULL, &uart_per_clk);
 DEFINE_CLOCK(uart3_clk,  0, CCM_CGCR2, 16, get_rate_uart, NULL, &uart_per_clk);
@@ -191,6 +198,7 @@ DEFINE_CLOCK(i2c_clk,	 0, CCM_CGCR0,  6, get_rate_i2c, NULL, NULL);
 DEFINE_CLOCK(fec_clk,	 0, CCM_CGCR1, 15, get_rate_ipg, NULL, &fec_ahb_clk);
 DEFINE_CLOCK(dryice_clk, 0, CCM_CGCR1,  8, get_rate_ipg, NULL, NULL);
 DEFINE_CLOCK(lcdc_clk,	 0, CCM_CGCR1, 29, get_rate_lcdc, NULL, &lcdc_per_clk);
+DEFINE_CLOCK(csi_clk,    0, CCM_CGCR1,  4, get_rate_csi, NULL,  &csi_per_clk);
 
 #define _REGISTER_CLOCK(d, n, c)	\
 	{				\
@@ -225,6 +233,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK("fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK("imxdi_rtc.0", NULL, dryice_clk)
 	_REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk)
+	_REGISTER_CLOCK("mx2-camera.0", NULL, csi_clk)
 };
 
 int __init mx25_clocks_init(void)
@@ -239,8 +248,9 @@ int __init mx25_clocks_init(void)
 	__raw_writel((0xf << 16) | (3 << 26), CRM_BASE + CCM_CGCR1);
 	__raw_writel((1 << 5), CRM_BASE + CCM_CGCR2);
 
-	/* Clock source for lcdc is upll */
-	__raw_writel(__raw_readl(CRM_BASE+0x64) | (1 << 7), CRM_BASE + 0x64);
+	/* Clock source for lcdc and csi is upll */
+	__raw_writel(__raw_readl(CRM_BASE+0x64) | (1 << 7) | (1 << 0),
+			CRM_BASE + 0x64);
 
 	mxc_timer_init(&gpt_clk, MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), 54);
 
arch/arm/mach-mx25/devices.c +22 -0
index 3f4b8a0..bc6d189 100644
@@ -500,3 +500,25 @@ struct platform_device mx25_fb_device = {
 		.coherent_dma_mask = 0xFFFFFFFF,
 	},
 };
+
+static struct resource mx25_csi_resources[] = {
+	{
+		.start	= MX25_CSI_BASE_ADDR,
+		.end	= MX25_CSI_BASE_ADDR + 0xfff,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.start	= MX25_INT_CSI,
+		.flags	= IORESOURCE_IRQ
+	},
+};
+
+struct platform_device mx25_csi_device = {
+	.name	= "mx2-camera",
+	.id	= 0,
+	.num_resources	= ARRAY_SIZE(mx25_csi_resources),
+	.resource	= mx25_csi_resources,
+	.dev		= {
+		.coherent_dma_mask = 0xFFFFFFFF,
+	},
+};
arch/arm/mach-mx25/devices.h +1 -0
index 39560e1..1e80ac2 100644
@@ -21,3 +21,4 @@ extern struct platform_device mx25_fec_device;
 extern struct platform_device mxc_nand_device;
 extern struct platform_device mx25_rtc_device;
 extern struct platform_device mx25_fb_device;
+extern struct platform_device mx25_csi_device;
arch/arm/plat-mxc/include/mach/mx25.h +2 -0
index 4eb6e33..5e6a8b5 100644
@@ -34,11 +34,13 @@
 #define MX25_NFC_BASE_ADDR		0xbb000000
 #define MX25_DRYICE_BASE_ADDR		0x53ffc000
 #define MX25_LCDC_BASE_ADDR		0x53fbc000
+#define MX25_CSI_BASE_ADDR		0x53ff8000
 
 #define MX25_INT_DRYICE	25
 #define MX25_INT_FEC	57
 #define MX25_INT_NANDFC	33
 #define MX25_INT_LCDC	39
+#define MX25_INT_CSI	17
 
 #if defined(IMX_NEEDS_DEPRECATED_SYMBOLS)
 #define UART1_BASE_ADDR			MX25_UART1_BASE_ADDR
Signature · 1 line
1.7.1
#6 lore raw

v3 cover Driver for the i.MX2x CMOS Sensor Interface

In reply to Baruch Siach

Hi linux-media list,

Ping?
Any news on this?

baruch

Quoted 50 lines · Baruch Siach

This series contains a soc_camera driver for the i.MX25/i.MX27 CSI device, and platform code for the i.MX25 and i.MX27 chips. This driver is based on a driver for i.MX27 CSI from Sascha Hauer, that Alan Carvalho de Assis has posted in linux-media last December[1]. I tested the mx2_camera driver on the i.MX25 PDK. Sascha Hauer has tested a earlier version of this driver on an i.MX27 based board. I included in this version some fixes from Sascha that enable i.MX27 support.

[1] https://patchwork.kernel.org/patch/67636/

Changes v2 -> v3
Address more comments from Guennadi Liakhovetski.

Applied part of Sashca's patch that I forgot in v2.

Changes v1 -> v2
Addressed the comments of Guennadi Liakhovetski except from the following:

1. The mclk_get_divisor implementation, since I don't know what this code is good for

2. mx2_videobuf_release should not set pcdev->active on i.MX27, because mx27_camera_frame_done needs this pointer

3. In mx27_camera_emma_buf_init I don't know the meaning of those hard coded magic numbers

Applied i.MX27 fixes from Sascha.

Baruch Siach (3):
mx2_camera: Add soc_camera support for i.MX25/i.MX27
mx27: add support for the CSI device
mx25: add support for the CSI device

 arch/arm/mach-mx2/clock_imx27.c          |    2 +-
 arch/arm/mach-mx2/devices.c              |   31 +
 arch/arm/mach-mx2/devices.h              |    1 +
 arch/arm/mach-mx25/clock.c               |   14 +-
 arch/arm/mach-mx25/devices.c             |   22 +
 arch/arm/mach-mx25/devices.h             |    1 +
 arch/arm/plat-mxc/include/mach/memory.h  |    4 +-
 arch/arm/plat-mxc/include/mach/mx25.h    |    2 +
 arch/arm/plat-mxc/include/mach/mx2_cam.h |   46 +
 drivers/media/video/Kconfig              |   13 +
 drivers/media/video/Makefile             |    1 +
 drivers/media/video/mx2_camera.c         | 1488 ++++++++++++++++++++++++++++++
 12 files changed, 1620 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/plat-mxc/include/mach/mx2_cam.h
 create mode 100644 drivers/media/video/mx2_camera.c
Signature · 3 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#7 lore raw

v3 cover Driver for the i.MX2x CMOS Sensor Interface

Quoted 4 lines · Baruch Siach

Hi linux-media list,

Ping?
Any news on this?

Hi Baruch

Sorry for taking longer to review this version, having a bit of a stressed week. I did look through this version briefly, looks good so far. I'll look at it again and come back to you, perhaps, end of the next week, or, with a lot of luck, today / tomorrow.

Thanks
Guennadi

Quoted 38 lines

baruch

Quoted 34 lines · Baruch Siach

This series contains a soc_camera driver for the i.MX25/i.MX27 CSI device, and platform code for the i.MX25 and i.MX27 chips. This driver is based on a driver for i.MX27 CSI from Sascha Hauer, that Alan Carvalho de Assis has posted in linux-media last December[1]. I tested the mx2_camera driver on the i.MX25 PDK. Sascha Hauer has tested a earlier version of this driver on an i.MX27 based board. I included in this version some fixes from Sascha that enable i.MX27 support.

[1] https://patchwork.kernel.org/patch/67636/

Changes v2 -> v3
Address more comments from Guennadi Liakhovetski.

Applied part of Sashca's patch that I forgot in v2.

Changes v1 -> v2
Addressed the comments of Guennadi Liakhovetski except from the following:

1. The mclk_get_divisor implementation, since I don't know what this code is good for

2. mx2_videobuf_release should not set pcdev->active on i.MX27, because mx27_camera_frame_done needs this pointer

3. In mx27_camera_emma_buf_init I don't know the meaning of those hard coded magic numbers

Applied i.MX27 fixes from Sascha.

Baruch Siach (3):
mx2_camera: Add soc_camera support for i.MX25/i.MX27
mx27: add support for the CSI device
mx25: add support for the CSI device

Quoted 22 lines
Quoted 16 lines
 arch/arm/mach-mx2/clock_imx27.c          |    2 +-
 arch/arm/mach-mx2/devices.c              |   31 +
 arch/arm/mach-mx2/devices.h              |    1 +
 arch/arm/mach-mx25/clock.c               |   14 +-
 arch/arm/mach-mx25/devices.c             |   22 +
 arch/arm/mach-mx25/devices.h             |    1 +
 arch/arm/plat-mxc/include/mach/memory.h  |    4 +-
 arch/arm/plat-mxc/include/mach/mx25.h    |    2 +
 arch/arm/plat-mxc/include/mach/mx2_cam.h |   46 +
 drivers/media/video/Kconfig              |   13 +
 drivers/media/video/Makefile             |    1 +
 drivers/media/video/mx2_camera.c         | 1488 ++++++++++++++++++++++++++++++
 12 files changed, 1620 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/plat-mxc/include/mach/mx2_cam.h
 create mode 100644 drivers/media/video/mx2_camera.c
Signature · 3 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - [email protected] - tel: +972.2.679.5364, http://www.tkos.co.il -

---
Guennadi Liakhovetski