summaryrefslogtreecommitdiff
path: root/linux/arch
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-04-03 15:34:05 +0200
committerGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-04-03 15:34:05 +0200
commit71bde24b27b74e98e8c4a4b253994b5e05ca42bf (patch)
treeb0ad378f86e73fa1ac65c81b694d6c3039e4b440 /linux/arch
parent88c3b5d5fa67f017ba19a29c6ef2a28cbc492b90 (diff)
downloadmediapointer-dvb-s2-71bde24b27b74e98e8c4a4b253994b5e05ca42bf.tar.gz
mediapointer-dvb-s2-71bde24b27b74e98e8c4a4b253994b5e05ca42bf.tar.bz2
Add camera (CSI) driver for MX1
From: Paulius Zaleckas <paulius.zaleckas@teltonika.lt> Add support for CMOS Sensor Interface on i.MX1 and i.MXL SoCs. Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt> Signed-off-by: Darius Augulis <augulis.darius@gmail.com> Acked-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> --- 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
Diffstat (limited to 'linux/arch')
-rw-r--r--linux/arch/arm/mach-mx1/Makefile5
-rw-r--r--linux/arch/arm/mach-mx1/devices.c2
-rw-r--r--linux/arch/arm/mach-mx1/ksym_mx1.c18
-rw-r--r--linux/arch/arm/mach-mx1/mx1_camera_fiq.S35
-rw-r--r--linux/arch/arm/plat-mxc/include/mach/memory.h8
-rw-r--r--linux/arch/arm/plat-mxc/include/mach/mx1_camera.h35
6 files changed, 101 insertions, 2 deletions
diff --git a/linux/arch/arm/mach-mx1/Makefile b/linux/arch/arm/mach-mx1/Makefile
index 82f130956..b72f53638 100644
--- a/linux/arch/arm/mach-mx1/Makefile
+++ b/linux/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
+
# 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/linux/arch/arm/mach-mx1/devices.c b/linux/arch/arm/mach-mx1/devices.c
index 97f42d96d..76d1ffb48 100644
--- a/linux/arch/arm/mach-mx1/devices.c
+++ b/linux/arch/arm/mach-mx1/devices.c
@@ -44,7 +44,7 @@ static struct resource imx_csi_resources[] = {
static u64 imx_csi_dmamask = 0xffffffffUL;
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/linux/arch/arm/mach-mx1/ksym_mx1.c b/linux/arch/arm/mach-mx1/ksym_mx1.c
new file mode 100644
index 000000000..b09ee12a4
--- /dev/null
+++ b/linux/arch/arm/mach-mx1/ksym_mx1.c
@@ -0,0 +1,18 @@
+/*
+ * Exported ksyms of ARCH_MX1
+ *
+ * Copyright (C) 2008, Darius Augulis <augulis.darius@gmail.com>
+ *
+ * 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 <linux/platform_device.h>
+#include <linux/module.h>
+
+#include <mach/mx1_camera.h>
+
+/* IMX camera FIQ handler */
+EXPORT_SYMBOL(mx1_camera_sof_fiq_start);
+EXPORT_SYMBOL(mx1_camera_sof_fiq_end);
diff --git a/linux/arch/arm/mach-mx1/mx1_camera_fiq.S b/linux/arch/arm/mach-mx1/mx1_camera_fiq.S
new file mode 100644
index 000000000..9c69aa65b
--- /dev/null
+++ b/linux/arch/arm/mach-mx1/mx1_camera_fiq.S
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2008 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
+ *
+ * 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 <linux/linkage.h>
+#include <asm/assembler.h>
+
+ .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, #0x00000001
+ 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, #0x00010000
+ str r12, [r10]
+ @ clear SOF flag
+ mov r12, #0x00010000
+ str r12, [r11]
+ @ return from FIQ
+ subs pc, lr, #4
+mx1_camera_sof_fiq_end:
diff --git a/linux/arch/arm/plat-mxc/include/mach/memory.h b/linux/arch/arm/plat-mxc/include/mach/memory.h
index cee836dfc..33bed2326 100644
--- a/linux/arch/arm/plat-mxc/include/mach/memory.h
+++ b/linux/arch/arm/plat-mxc/include/mach/memory.h
@@ -25,4 +25,12 @@
#define CONSISTENT_DMA_SIZE SZ_8M
#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/linux/arch/arm/plat-mxc/include/mach/mx1_camera.h b/linux/arch/arm/plat-mxc/include/mach/mx1_camera.h
new file mode 100644
index 000000000..4fd6c7031
--- /dev/null
+++ b/linux/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 <paulius.zaleckas@teltonika.lt>
+ * Copyright (C) 2009, Darius Augulis <augulis.darius@gmail.com>
+ *
+ * Based on PXA camera.h file:
+ * Copyright (C) 2003, Intel Corporation
+ * Copyright (C) 2008, Guennadi Liakhovetski <kernel@pengutronix.de>
+ *
+ * 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.
+ */
+
+#ifndef __ASM_ARCH_CAMERA_H_
+#define __ASM_ARCH_CAMERA_H_
+
+#define MX1_CAMERA_DATA_HIGH 1
+#define MX1_CAMERA_PCLK_RISING 2
+#define MX1_CAMERA_VSYNC_HIGH 4
+
+extern unsigned char mx1_camera_sof_fiq_start, mx1_camera_sof_fiq_end;
+
+/**
+ * struct mx1_camera_pdata - i.MX1/i.MXL camera platform data
+ * @mclk_10khz: master clock frequency in 10kHz units
+ * @flags: MX1 camera platform flags
+ */
+struct mx1_camera_pdata {
+ unsigned long mclk_10khz;
+ unsigned long flags;
+};
+
+#endif /* __ASM_ARCH_CAMERA_H_ */