Web lists-archives.org

[RFC PATCH 8/8] Phycore pcm-990-specific code for the PXA270 Quick Capture driver




This patch applies on top of the (backported to 2.6.23 in this
version) patch-series:

 mach pxa: Adding Phytec's phyCORE-PXA270 platform

posted on the linux-arm-kernel mailing list.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@xxxxxxxxxxxxxx>
---
 arch/arm/mach-pxa/pcm990-baseboard.c |  108 ++++++++++++++++++++++++++++++++++
 1 files changed, 108 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c
index 3dda16a..0e373cc 100644
--- a/arch/arm/mach-pxa/pcm990-baseboard.c
+++ b/arch/arm/mach-pxa/pcm990-baseboard.c
@@ -23,6 +23,11 @@
 #include <linux/irq.h>
 #include <linux/platform_device.h>
 #include <linux/ide.h>
+#include <linux/i2c.h>
+
+#include <media/soc_camera.h>
+
+#include <asm/arch/pxa_cif.h>
 #include <asm/mach/map.h>
 #include <asm/arch/pxa-regs.h>
 #include <asm/arch/mmc.h>
@@ -258,6 +263,102 @@ static struct pxaohci_platform_data pcm990_ohci_platform_data = {
 };
 
 /*
+ * PXA27x Camera specific stuff
+ */
+#if defined(CONFIG_VIDEO_PXA27X) || defined(CONFIG_VIDEO_PXA27X_MODULE)
+static int pcm027_pxacamera_init(struct device *dev)
+{
+	pxa_gpio_mode(GPIO98_CIF_DD0_MD);
+	pxa_gpio_mode(GPIO105_CIF_DD1_MD);
+	pxa_gpio_mode(GPIO104_CIF_DD2_MD);
+	pxa_gpio_mode(GPIO103_CIF_DD3_MD);
+	pxa_gpio_mode(GPIO95_CIF_DD4_MD);
+	pxa_gpio_mode(GPIO94_CIF_DD5_MD);
+	pxa_gpio_mode(GPIO93_CIF_DD6_MD);
+	pxa_gpio_mode(GPIO108_CIF_DD7_MD);
+	pxa_gpio_mode(GPIO107_CIF_DD8_MD);
+	pxa_gpio_mode(GPIO106_CIF_DD9_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);
+
+	pxa_set_cken(CKEN_CAMERA, 1);
+	CICR4 = CICR4_MCLK_EN | 4;
+
+	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 pcm027_pxacamera_platform_data = {
+	.init	= pcm027_pxacamera_init,
+	.flags  = PXACIF_MASTER | PXACIF_DATAWIDTH_8 | PXACIF_DATAWIDTH_10 |
+		PXACIF_PCLK_EN | PXACIF_MCLK_EN/* | PXACIF_PCP*/,
+	.mclk_10khz = 1000,
+};
+
+static struct resource pxacamera_resources[] = {
+	[0] = {
+		.start	= 0x50000000,
+		.end	= 0x50000000 + 0xfff,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= IRQ_CAMERA,
+		.end	= IRQ_CAMERA,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static u64 pxacamera_dmamask = 0xffffffffUL;
+
+static struct platform_device pxacamera_device = {
+	.name		= "pxa2xx-camera",
+	.id		= 0, /* This is used to put cameras on this interface */
+	.dev		= {
+		.dma_mask      		= &pxacamera_dmamask,
+		.coherent_dma_mask	= 0xffffffff,
+		.platform_data		= &pcm027_pxacamera_platform_data,
+	},
+	.num_resources	= ARRAY_SIZE(pxacamera_resources),
+	.resource	= pxacamera_resources,
+};
+
+static struct i2c_client *mt9m001_data_bus_switch;
+
+static struct soc_camera_link iclink[] = {
+	{
+		.bus_id		= 0, /* Must match with the camera ID above */
+		.extender	= &mt9m001_data_bus_switch,
+	}, {
+		.bus_id		= 0, /* Must match with the camera ID above */
+	}
+};
+
+/* Board I2C devices. */
+static struct i2c_board_info __initdata pcm027_i2c_devices[] = {
+	{
+		/* Must initialize before the camera(s) */
+		I2C_BOARD_INFO("pca9536", 0x41),
+		.type = "pca9536",
+		.platform_data = &mt9m001_data_bus_switch,
+	}, {
+		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
  */
@@ -326,5 +427,12 @@ void __init pcm990_baseboard_init(void)
 	/* USB host */
 	pxa_set_ohci_info(&pcm990_ohci_platform_data);
 
+#if defined(CONFIG_VIDEO_PXA27X) || defined(CONFIG_VIDEO_PXA27X_MODULE)
+	platform_device_register(&pxacamera_device);
+
+	i2c_register_board_info(0, pcm027_i2c_devices,
+		ARRAY_SIZE(pcm027_i2c_devices));
+#endif
+
 	printk(KERN_INFO"PCM-990 Evaluation baseboard initialized\n");
 }
-- 
1.5.3.4

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list