[ARM] pxa: Phycore pcm-990-specific code for the PXA270 Quick Capture driver

Platform-specific code for Phytec's phyCORE-PXA270 platform

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c
index 20b2974..e6be9d0 100644
--- a/arch/arm/mach-pxa/pcm990-baseboard.c
+++ b/arch/arm/mach-pxa/pcm990-baseboard.c
@@ -23,6 +23,13 @@
 #include <linux/irq.h>
 #include <linux/platform_device.h>
 #include <linux/ide.h>
+#include <linux/i2c.h>
+
+#include <media/soc_camera.h>
+
+#include <asm/gpio.h>
+#include <asm/arch/i2c.h>
+#include <asm/arch/camera.h>
 #include <asm/mach/map.h>
 #include <asm/arch/pxa-regs.h>
 #include <asm/arch/pxa2xx-gpio.h>
@@ -259,6 +266,76 @@
 };
 
 /*
+ * PXA27x Camera specific stuff
+ */
+#if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE)
+static int pcm990_pxacamera_init(struct device *dev)
+{
+	pxa_gpio_mode(GPIO98_CIF_DD_0_MD);
+	pxa_gpio_mode(GPIO105_CIF_DD_1_MD);
+	pxa_gpio_mode(GPIO104_CIF_DD_2_MD);
+	pxa_gpio_mode(GPIO103_CIF_DD_3_MD);
+	pxa_gpio_mode(GPIO95_CIF_DD_4_MD);
+	pxa_gpio_mode(GPIO94_CIF_DD_5_MD);
+	pxa_gpio_mode(GPIO93_CIF_DD_6_MD);
+	pxa_gpio_mode(GPIO108_CIF_DD_7_MD);
+	pxa_gpio_mode(GPIO107_CIF_DD_8_MD);
+	pxa_gpio_mode(GPIO106_CIF_DD_9_MD);
+	pxa_gpio_mode(GPIO42_CIF_MCLK_MD);
+	pxa_gpio_mode(GPIO45_CIF_PCLK_MD);
+	pxa_gpio_mode(GPIO43_CIF_FV_MD);
+	pxa_gpio_mode(GPIO44_CIF_LV_MD);
+
+	return 0;
+}
+
+/*
+ * CICR4: PCLK_EN:	Pixel clock is supplied by the sensor
+ *	MCLK_EN:	Master clock is generated by PXA
+ *	PCP:		Data sampled on the falling edge of pixel clock
+ */
+struct pxacamera_platform_data pcm990_pxacamera_platform_data = {
+	.init	= pcm990_pxacamera_init,
+	.flags  = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 | PXA_CAMERA_DATAWIDTH_10 |
+		PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN/* | PXA_CAMERA_PCP*/,
+	.mclk_10khz = 1000,
+};
+
+#include <linux/i2c/pca953x.h>
+
+static struct pca953x_platform_data pca9536_data = {
+	.gpio_base	= NR_BUILTIN_GPIO + 1,
+};
+
+static struct soc_camera_link iclink[] = {
+	{
+		.bus_id	= 0, /* Must match with the camera ID above */
+		.gpio	= NR_BUILTIN_GPIO + 1,
+	}, {
+		.bus_id	= 0, /* Must match with the camera ID above */
+	}
+};
+
+/* Board I2C devices. */
+static struct i2c_board_info __initdata pcm990_i2c_devices[] = {
+	{
+		/* Must initialize before the camera(s) */
+		I2C_BOARD_INFO("pca953x", 0x41),
+		.type = "pca9536",
+		.platform_data = &pca9536_data,
+	}, {
+		I2C_BOARD_INFO("mt9v022", 0x48),
+		.type = "mt9v022",
+		.platform_data = &iclink[0], /* With extender */
+	}, {
+		I2C_BOARD_INFO("mt9m001", 0x5d),
+		.type = "mt9m001",
+		.platform_data = &iclink[0], /* With extender */
+	},
+};
+#endif /* CONFIG_VIDEO_PXA27x ||CONFIG_VIDEO_PXA27x_MODULE */
+
+/*
  * AC97 support
  * Note: The connected AC97 mixer also reports interrupts at PCM990_AC97_IRQ
  */
@@ -327,5 +404,14 @@
 	/* USB host */
 	pxa_set_ohci_info(&pcm990_ohci_platform_data);
 
+	pxa_set_i2c_info(NULL);
+
+#if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE)
+	pxa_set_camera_info(&pcm990_pxacamera_platform_data);
+
+	i2c_register_board_info(0, pcm990_i2c_devices,
+		ARRAY_SIZE(pcm990_i2c_devices));
+#endif
+
 	printk(KERN_INFO"PCM-990 Evaluation baseboard initialized\n");
 }