[PATCH V4] Add camera (CSI) driver for MX1
From: Paulius Zaleckas Signed-off-by: Darius Augulis Signed-off-by: Paulius Zaleckas --- arch/arm/mach-mx1/Makefile |5 arch/arm/mach-mx1/devices.c |2 arch/arm/mach-mx1/ksym_mx1.c| 18 + arch/arm/mach-mx1/mx1_camera_fiq.S | 35 + arch/arm/plat-mxc/include/mach/memory.h |8 arch/arm/plat-mxc/include/mach/mx1_camera.h | 35 + drivers/media/video/Kconfig | 13 drivers/media/video/Makefile|1 drivers/media/video/mx1_camera.c| 827 +++ 9 files changed, 941 insertions(+), 3 deletions(-) create mode 100644 arch/arm/mach-mx1/ksym_mx1.c create mode 100644 arch/arm/mach-mx1/mx1_camera_fiq.S create mode 100644 arch/arm/plat-mxc/include/mach/mx1_camera.h create mode 100644 drivers/media/video/mx1_camera.c diff --git a/arch/arm/mach-mx1/Makefile b/arch/arm/mach-mx1/Makefile index 5e85456..2097021 100644 --- a/arch/arm/mach-mx1/Makefile +++ b/arch/arm/mach-mx1/Makefile @@ -6,6 +6,9 @@ obj-y += generic.o clock.o devices.o +# Support for CMOS sensor interface +obj-$(CONFIG_MX1_VIDEO)+= ksym_mx1.o mx1_camera_fiq.o + # Power management obj-$(CONFIG_PM) += pm.o @@ -15,4 +18,4 @@ endif # Specific board support obj-$(CONFIG_ARCH_MX1ADS) += mx1ads.o -obj-$(CONFIG_MACH_SCB9328) += scb9328.o \ No newline at end of file +obj-$(CONFIG_MACH_SCB9328) += scb9328.o diff --git a/arch/arm/mach-mx1/devices.c b/arch/arm/mach-mx1/devices.c index 97f42d9..76d1ffb 100644 --- a/arch/arm/mach-mx1/devices.c +++ b/arch/arm/mach-mx1/devices.c @@ -44,7 +44,7 @@ static struct resource imx_csi_resources[] = { static u64 imx_csi_dmamask = 0xUL; struct platform_device imx_csi_device = { - .name = "imx-csi", + .name = "mx1-camera", .id = 0, /* This is used to put cameras on this interface */ .dev= { .dma_mask = &imx_csi_dmamask, diff --git a/arch/arm/mach-mx1/ksym_mx1.c b/arch/arm/mach-mx1/ksym_mx1.c new file mode 100644 index 000..b09ee12 --- /dev/null +++ b/arch/arm/mach-mx1/ksym_mx1.c @@ -0,0 +1,18 @@ +/* + * Exported ksyms of ARCH_MX1 + * + * Copyright (C) 2008, Darius Augulis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include + +#include + +/* IMX camera FIQ handler */ +EXPORT_SYMBOL(mx1_camera_sof_fiq_start); +EXPORT_SYMBOL(mx1_camera_sof_fiq_end); diff --git a/arch/arm/mach-mx1/mx1_camera_fiq.S b/arch/arm/mach-mx1/mx1_camera_fiq.S new file mode 100644 index 000..9c69aa6 --- /dev/null +++ b/arch/arm/mach-mx1/mx1_camera_fiq.S @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2008 Paulius Zaleckas + * + * Based on linux/arch/arm/lib/floppydma.S + * Copyright (C) 1995, 1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include +#include + + .text + .global mx1_camera_sof_fiq_end + .global mx1_camera_sof_fiq_start +mx1_camera_sof_fiq_start: + @ enable dma + ldr r12, [r9] + orr r12, r12, #0x0001 + str r12, [r9] + @ unmask DMA interrupt + ldr r12, [r8] + bic r12, r12, r13 + str r12, [r8] + @ disable SOF interrupt + ldr r12, [r10] + bic r12, r12, #0x0001 + str r12, [r10] + @ clear SOF flag + mov r12, #0x0001 + str r12, [r11] + @ return from FIQ + subspc, lr, #4 +mx1_camera_sof_fiq_end: diff --git a/arch/arm/plat-mxc/include/mach/memory.h b/arch/arm/plat-mxc/include/mach/memory.h index e0783e6..eca37d0 100644 --- a/arch/arm/plat-mxc/include/mach/memory.h +++ b/arch/arm/plat-mxc/include/mach/memory.h @@ -24,4 +24,12 @@ #define PHYS_OFFSETUL(0x8000) #endif +#if defined(CONFIG_MX1_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 /* __ASM_ARCH_MXC_MEMORY_H__ */ diff --git a/arch/arm/plat-mxc/include/mach/mx1_camera.h b/arch/arm/plat-mxc/include/mach/mx1_camera.h new file mode 100644 index 000..4fd6c70 --- /dev/null +++ b/arch/arm/plat-mxc/include/mach/mx1_camera.h @@ -0,0 +1,35 @@ +/* + * mx1_camera.h - i.MX1/i.MXL camera driver header file + * + * Copyright (c) 2008, Paulius Zaleckas + * Copyright (C) 2009, Darius Augulis + * + * Based on PXA camera.h file: + * Co
Re: [PATCH V4] Add camera (CSI) driver for MX1
Changelog since V3: - DMA buffer size decreased to 4Mbytes - Added pdata test in set_bus_param() -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V4] Add camera (CSI) driver for MX1
On Fri, 3 Apr 2009, Darius Augulis wrote: > From: Paulius Zaleckas > > Signed-off-by: Darius Augulis > Signed-off-by: Paulius Zaleckas Ok, I'll just swap these two Sob's to reflect the processing chain, add a description like Add support for CMOS Sensor Interface on i.MX1 and i.MXL SoCs. and fix a couple of trivial conflicts, which probably appear, because you based your patches on an MXC tree, and not on current linux-next. Wondering, if it still will work then... At least it compiles. BTW, should it really also work with IMX? Then you might want to change this depends on VIDEO_DEV && ARCH_MX1 && SOC_CAMERA to depends on VIDEO_DEV && (ARCH_MX1 || ARCH_IMX) && SOC_CAMERA but you can do this later, maybe, when you actually get a chance to test it on IMX (if you haven't done so yet). Sascha, we need your ack for the ARM part. Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V4] Add camera (CSI) driver for MX1
On Fri, Apr 03, 2009 at 02:15:34PM +0200, Guennadi Liakhovetski wrote: > On Fri, 3 Apr 2009, Darius Augulis wrote: > > > From: Paulius Zaleckas > > > > Signed-off-by: Darius Augulis > > Signed-off-by: Paulius Zaleckas > > Ok, I'll just swap these two Sob's to reflect the processing chain, add a > description like > > Add support for CMOS Sensor Interface on i.MX1 and i.MXL SoCs. > > and fix a couple of trivial conflicts, which probably appear, because you > based your patches on an MXC tree, and not on current linux-next. > Wondering, if it still will work then... At least it compiles. BTW, should > it really also work with IMX? Then you might want to change this > > depends on VIDEO_DEV && ARCH_MX1 && SOC_CAMERA > > to > > depends on VIDEO_DEV && (ARCH_MX1 || ARCH_IMX) && SOC_CAMERA This shouldn't be necessary. ARCH_IMX does not have the platform part to make use of this driver and will never get it. > > but you can do this later, maybe, when you actually get a chance to test > it on IMX (if you haven't done so yet). > > Sascha, we need your ack for the ARM part. I'm OK with this driver: I have never worked with FIQs though so I can't say much to it. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V4] Add camera (CSI) driver for MX1
Sascha Hauer wrote: On Fri, Apr 03, 2009 at 02:15:34PM +0200, Guennadi Liakhovetski wrote: On Fri, 3 Apr 2009, Darius Augulis wrote: From: Paulius Zaleckas Signed-off-by: Darius Augulis Signed-off-by: Paulius Zaleckas Ok, I'll just swap these two Sob's to reflect the processing chain, add a description like Add support for CMOS Sensor Interface on i.MX1 and i.MXL SoCs. and fix a couple of trivial conflicts, which probably appear, because you based your patches on an MXC tree, and not on current linux-next. Wondering, if it still will work then... At least it compiles. BTW, should it really also work with IMX? Then you might want to change this depends on VIDEO_DEV && ARCH_MX1 && SOC_CAMERA to depends on VIDEO_DEV && (ARCH_MX1 || ARCH_IMX) && SOC_CAMERA This shouldn't be necessary. ARCH_IMX does not have the platform part to make use of this driver and will never get it. but you can do this later, maybe, when you actually get a chance to test it on IMX (if you haven't done so yet). Sascha, we need your ack for the ARM part. I'm OK with this driver: I have never worked with FIQs though so I can't say much to it. At least I can confirm it worked well with 2.6.28.5 kernel version. Sascha -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V4] Add camera (CSI) driver for MX1
On Fri, 3 Apr 2009, Sascha Hauer wrote: > On Fri, Apr 03, 2009 at 02:15:34PM +0200, Guennadi Liakhovetski wrote: > > Wondering, if it still will work then... At least it compiles. BTW, should > > it really also work with IMX? Then you might want to change this > > > > depends on VIDEO_DEV && ARCH_MX1 && SOC_CAMERA > > > > to > > > > depends on VIDEO_DEV && (ARCH_MX1 || ARCH_IMX) && SOC_CAMERA > > This shouldn't be necessary. ARCH_IMX does not have the platform part to > make use of this driver and will never get it. Confused... Then why the whole that "IMX/MX1" in the driver? And why will it never get it - are they compatible or not? Or just there's no demand / chips are EOLed or something... > > but you can do this later, maybe, when you actually get a chance to test > > it on IMX (if you haven't done so yet). > > > > Sascha, we need your ack for the ARM part. > > I'm OK with this driver: I have never worked with FIQs though so I can't > say much to it. Ok, I take it as an "Acked-by" then:-) Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V4] Add camera (CSI) driver for MX1
On Fri, Apr 03, 2009 at 02:41:16PM +0200, Guennadi Liakhovetski wrote: > On Fri, 3 Apr 2009, Sascha Hauer wrote: > > > On Fri, Apr 03, 2009 at 02:15:34PM +0200, Guennadi Liakhovetski wrote: > > > Wondering, if it still will work then... At least it compiles. BTW, > > > should > > > it really also work with IMX? Then you might want to change this > > > > > > depends on VIDEO_DEV && ARCH_MX1 && SOC_CAMERA > > > > > > to > > > > > > depends on VIDEO_DEV && (ARCH_MX1 || ARCH_IMX) && SOC_CAMERA > > > > This shouldn't be necessary. ARCH_IMX does not have the platform part to > > make use of this driver and will never get it. > > Confused... Then why the whole that "IMX/MX1" in the driver? And why will > it never get it - are they compatible or not? Not just compatible, they are the same. A little bit of history: I originally brought i.MX1 support to the kernel in the early 2.6 days. around 2.6.25 Freescale pushed initial i.MX31 support using plat-mxc. We in turn based our i.MX27 port on this code and since then it evolved further. Darius based a new i.MX1 support on this code and now we can remove arch-imx. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V4] Add camera (CSI) driver for MX1
Guennadi Liakhovetski wrote: On Fri, 3 Apr 2009, Sascha Hauer wrote: On Fri, Apr 03, 2009 at 02:15:34PM +0200, Guennadi Liakhovetski wrote: Wondering, if it still will work then... At least it compiles. BTW, should it really also work with IMX? Then you might want to change this depends on VIDEO_DEV && ARCH_MX1 && SOC_CAMERA to depends on VIDEO_DEV && (ARCH_MX1 || ARCH_IMX) && SOC_CAMERA This shouldn't be necessary. ARCH_IMX does not have the platform part to make use of this driver and will never get it. Confused... Then why the whole that "IMX/MX1" in the driver? And why will it never get it - are they compatible or not? Or just there's no demand / chips are EOLed or something... in Linux kernel "imx" is the old name of "mx1". mx1 contains of two processors: i.MX1 and i.MXL. but you can do this later, maybe, when you actually get a chance to test it on IMX (if you haven't done so yet). Sascha, we need your ack for the ARM part. I'm OK with this driver: I have never worked with FIQs though so I can't say much to it. Ok, I take it as an "Acked-by" then:-) Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V4] Add camera (CSI) driver for MX1
On Fri, 3 Apr 2009, Darius Augulis wrote: > Guennadi Liakhovetski wrote: > > > > Confused... Then why the whole that "IMX/MX1" in the driver? And why will it > > never get it - are they compatible or not? Or just there's no demand / chips > > are EOLed or something... > > in Linux kernel "imx" is the old name of "mx1". > mx1 contains of two processors: i.MX1 and i.MXL. Ah, ok, I see now. I thought i.MXL was under ARCH_IMX and _not_ ARCH_MX1. That was my confusion. Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html