diff mbox

[v3] OMAP1: Add support for SoC camera interface

Message ID 201009270302.28655.jkrzyszt@tis.icnet.pl (mailing list archive)
State RFC
Headers show

Commit Message

Janusz Krzysztofik Sept. 27, 2010, 1:02 a.m. UTC
None
diff mbox

Patch

diff -upr linux-2.6.36-rc5.orig/arch/arm/mach-omap1/devices.c linux-2.6.36-rc5/arch/arm/mach-omap1/devices.c
--- linux-2.6.36-rc5.orig/arch/arm/mach-omap1/devices.c	2010-09-24 15:34:27.000000000 +0200
+++ linux-2.6.36-rc5/arch/arm/mach-omap1/devices.c	2010-09-25 03:47:55.000000000 +0200
@@ -9,6 +9,7 @@ 
  * (at your option) any later version.
  */
 
+#include <linux/dma-mapping.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -191,6 +192,48 @@  static inline void omap_init_spi100k(voi
 }
 #endif
 
+
+#define OMAP1_CAMERA_BASE	0xfffb6800
+#define OMAP1_CAMERA_IOSIZE	0x1c
+
+static struct resource omap1_camera_resources[] = {
+	[0] = {
+		.start	= OMAP1_CAMERA_BASE,
+		.end	= OMAP1_CAMERA_BASE + OMAP1_CAMERA_IOSIZE - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= INT_CAMERA,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static u64 omap1_camera_dma_mask = DMA_BIT_MASK(32);
+
+static struct platform_device omap1_camera_device = {
+	.name		= "omap1-camera",
+	.id		= 0, /* This is used to put cameras on this interface */
+	.dev		= {
+		.dma_mask		= &omap1_camera_dma_mask,
+		.coherent_dma_mask	= DMA_BIT_MASK(32),
+	},
+	.num_resources	= ARRAY_SIZE(omap1_camera_resources),
+	.resource	= omap1_camera_resources,
+};
+
+void __init omap1_camera_init(void *info)
+{
+	struct platform_device *dev = &omap1_camera_device;
+	int ret;
+
+	dev->dev.platform_data = info;
+
+	ret = platform_device_register(dev);
+	if (ret)
+		dev_err(&dev->dev, "unable to register device: %d\n", ret);
+}
+
+
 /*-------------------------------------------------------------------------*/
 
 static inline void omap_init_sti(void) {}
diff -upr linux-2.6.36-rc5.orig/arch/arm/mach-omap1/include/mach/camera.h linux-2.6.36-rc5/arch/arm/mach-omap1/include/mach/camera.h
--- linux-2.6.36-rc5.orig/arch/arm/mach-omap1/include/mach/camera.h	2010-09-24 15:39:07.000000000 +0200
+++ linux-2.6.36-rc5/arch/arm/mach-omap1/include/mach/camera.h	2010-09-25 03:19:12.000000000 +0200
@@ -0,0 +1,13 @@ 
+#ifndef __ASM_ARCH_CAMERA_H_
+#define __ASM_ARCH_CAMERA_H_
+
+#include <media/omap1_camera.h>
+
+void omap1_camera_init(void *);
+
+static inline void omap1_set_camera_info(struct omap1_cam_platform_data *info)
+{
+	omap1_camera_init(info);
+}
+
+#endif /* __ASM_ARCH_CAMERA_H_ */