diff mbox

[RFC,2/6] OMAP1: Add support for SoC camera interface

Message ID 201007180623.10663.jkrzyszt@tis.icnet.pl (mailing list archive)
State New, archived
Headers show

Commit Message

Janusz Krzysztofik July 18, 2010, 4:23 a.m. UTC
None
diff mbox

Patch

--- linux-2.6.35-rc3.orig/arch/arm/mach-omap1/devices.c	2010-06-26 15:54:47.000000000 +0200
+++ linux-2.6.35-rc3/arch/arm/mach-omap1/devices.c	2010-07-18 01:54:39.000000000 +0200
@@ -15,6 +15,7 @@ 
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/spi/spi.h>
+#include <linux/dma-mapping.h>
 
 #include <mach/hardware.h>
 #include <asm/mach/map.h>
@@ -25,6 +26,7 @@ 
 #include <mach/gpio.h>
 #include <plat/mmc.h>
 #include <plat/omap7xx.h>
+#include <mach/camera.h>
 
 /*-------------------------------------------------------------------------*/
 
@@ -267,6 +269,47 @@  static inline void omap_init_sti(void)
 static inline void omap_init_sti(void) {}
 #endif
 
+
+#define OMAP1_CAMERA_BASE	0xfffb6800
+
+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_set_camera_info(struct omap1_cam_platform_data *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);
+}
+
+
 /*-------------------------------------------------------------------------*/
 
 /*
--- linux-2.6.35-rc3.orig/arch/arm/mach-omap1/include/mach/camera.h	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.35-rc3/arch/arm/mach-omap1/include/mach/camera.h	2010-07-18 01:57:18.000000000 +0200
@@ -0,0 +1,8 @@ 
+#ifndef __ASM_ARCH_CAMERA_H_
+#define __ASM_ARCH_CAMERA_H_
+
+#include <media/omap1_camera.h>
+
+extern void omap1_set_camera_info(struct omap1_cam_platform_data *);
+
+#endif /* __ASM_ARCH_CAMERA_H_ */