2009-03-26 14:49:01

by Daniel Glöckner

[permalink] [raw]
Subject: [patch 1/5] xtensa: add s6000 data port to s6105 platform

Signed-off-by: Daniel Glöckner <[email protected]>
---
arch/xtensa/platforms/s6105/device.c | 40 ++++++++++++++++++++
arch/xtensa/platforms/s6105/include/platform/irq.h | 1 +
arch/xtensa/platforms/s6105/setup.c | 2 +
3 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/arch/xtensa/platforms/s6105/device.c b/arch/xtensa/platforms/s6105/device.c
index f7af6d2..9238d24 100644
--- a/arch/xtensa/platforms/s6105/device.c
+++ b/arch/xtensa/platforms/s6105/device.c
@@ -22,6 +22,7 @@
#include <linux/spi/mmc_spi.h>
#include <linux/spi/spi.h>
#include <linux/spi/spi_s6000.h>
+#include <media/s6dp-link.h>

#include <variant/hardware.h>
#include <variant/dmac.h>
@@ -53,6 +54,14 @@ static const signed char i2c_irq_mappings[] = {
-1
};

+static const signed char dp_irq_mappings[] = {
+ S6_INTC_DMA_DPTERMCNT(0),
+ S6_INTC_DMA_DPTERMCNT(1),
+ S6_INTC_DMA_DPTERMCNT(2),
+ S6_INTC_DMA_DPTERMCNT(3),
+ -1
+};
+
static const signed char isef_irq_mappings[] = {
S6_INTC_DMA_LMSPENDCNT(11),
-1
@@ -75,6 +84,7 @@ const signed char *platform_irq_mappings[NR_IRQS] = {
[UART_INTNUM] = uart_irq_mappings,
[GMAC_INTNUM] = gmac_irq_mappings,
[I2C_INTNUM] = i2c_irq_mappings,
+ [DP_INTNUM] = dp_irq_mappings,
[ISEF_INTNUM] = isef_irq_mappings,
[I2S_INTNUM] = i2s_irq_mappings,
[SPI_INTNUM] = spi_irq_mappings,
@@ -191,6 +201,10 @@ static struct resource s6_i2c_resource[] = {
#define S6I2C_ADDR_CDCE906 0x69
#define S6I2C_ADDR_PCA9543 0x73

+static struct s6dp_link s6dp_links[] = {
+ { }
+};
+
static struct i2c_board_info __initdata s6_i2c_devices[] = {
{
I2C_BOARD_INFO("24c02", S6I2C_ADDR_AT24HC02B),
@@ -355,6 +369,23 @@ static struct spi_board_info __initdata s6_spi_devices[] = {
},
};

+static struct resource s6_dp_resource[] = {
+ {
+ .start = (resource_size_t)S6_REG_DP,
+ .end = (resource_size_t)S6_REG_DP + 0x10000 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = (resource_size_t)S6_REG_DPDMA,
+ .end = (resource_size_t)S6_REG_DPDMA + 0x10000 - 1,
+ .flags = IORESOURCE_DMA,
+ },
+ {
+ .start = (resource_size_t)DP_INTNUM,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
static struct platform_device platform_devices[] = {
{
.name = "serial8250",
@@ -391,6 +422,15 @@ static struct platform_device platform_devices[] = {
.platform_data = &s6_spi_pdata,
},
},
+ {
+ .name = "s6dp",
+ .id = -1,
+ .resource = s6_dp_resource,
+ .num_resources = ARRAY_SIZE(s6_dp_resource),
+ .dev = {
+ .platform_data = &s6dp_links,
+ },
+ },
};

static int __init device_init(void)
diff --git a/arch/xtensa/platforms/s6105/include/platform/irq.h b/arch/xtensa/platforms/s6105/include/platform/irq.h
index 84c972f..65f6d92 100644
--- a/arch/xtensa/platforms/s6105/include/platform/irq.h
+++ b/arch/xtensa/platforms/s6105/include/platform/irq.h
@@ -5,6 +5,7 @@
#define UART_INTNUM 4
#define GMAC_INTNUM 5
#define I2C_INTNUM 6
+#define DP_INTNUM 7
#define ISEF_INTNUM 8
#define I2S_INTNUM 10
#define SPI_INTNUM 11
diff --git a/arch/xtensa/platforms/s6105/setup.c b/arch/xtensa/platforms/s6105/setup.c
index bbd1730..87ae88c 100644
--- a/arch/xtensa/platforms/s6105/setup.c
+++ b/arch/xtensa/platforms/s6105/setup.c
@@ -46,12 +46,14 @@ void __init platform_setup(char **cmdline)
reg &= ~(1 << S6_GREG1_BLOCK_SB);
reg &= ~(1 << S6_GREG1_BLOCK_GMAC);
reg &= ~(1 << S6_GREG1_BLOCK_I2S);
+ reg &= ~(1 << S6_GREG1_BLOCK_DP);
writel(reg, S6_REG_GREG1 + S6_GREG1_CLKGATE);

reg = readl(S6_REG_GREG1 + S6_GREG1_BLOCKENA);
reg |= 1 << S6_GREG1_BLOCK_SB;
reg |= 1 << S6_GREG1_BLOCK_GMAC;
reg |= 1 << S6_GREG1_BLOCK_I2S;
+ reg |= 1 << S6_GREG1_BLOCK_DP;
writel(reg, S6_REG_GREG1 + S6_GREG1_BLOCKENA);

printk(KERN_NOTICE "S6105 on Stretch S6000 - "
--
1.6.2.107.ge47ee


2009-03-26 14:48:46

by Daniel Glöckner

[permalink] [raw]
Subject: [patch 2/5] xtensa: add saa7121 to s6105 platform

Signed-off-by: Daniel Glöckner <[email protected]>
---
arch/xtensa/platforms/s6105/device.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/xtensa/platforms/s6105/device.c b/arch/xtensa/platforms/s6105/device.c
index 9238d24..07fb329 100644
--- a/arch/xtensa/platforms/s6105/device.c
+++ b/arch/xtensa/platforms/s6105/device.c
@@ -202,6 +202,11 @@ static struct resource s6_i2c_resource[] = {
#define S6I2C_ADDR_PCA9543 0x73

static struct s6dp_link s6dp_links[] = {
+ {
+ .port_mask = 1 << 2,
+ .is_egress = 1,
+ .minor = 2,
+ },
{ }
};

@@ -212,6 +217,10 @@ static struct i2c_board_info __initdata s6_i2c_devices[] = {
{
I2C_BOARD_INFO("m41t62", S6I2C_ADDR_M41T62),
},
+ {
+ I2C_BOARD_INFO("saa7121", S6I2C_ADDR_SAA7121),
+ .platform_data = &s6dp_links[0],
+ },
};

static struct resource s6_isef_resource[] = {
--
1.6.2.107.ge47ee

2009-03-26 14:49:25

by Daniel Glöckner

[permalink] [raw]
Subject: [patch 4/5] xtensa: add resources for canonical data port modes to s6105 platform

From: Oskar Schirmer <[email protected]>

Signed-off-by: Oskar Schirmer <[email protected]>
---
arch/xtensa/platforms/s6105/device.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/arch/xtensa/platforms/s6105/device.c b/arch/xtensa/platforms/s6105/device.c
index ff047fc..dec1d88 100644
--- a/arch/xtensa/platforms/s6105/device.c
+++ b/arch/xtensa/platforms/s6105/device.c
@@ -59,6 +59,10 @@ static const signed char dp_irq_mappings[] = {
S6_INTC_DMA_DPTERMCNT(1),
S6_INTC_DMA_DPTERMCNT(2),
S6_INTC_DMA_DPTERMCNT(3),
+#ifdef CONFIG_VIDEO_S6000_CANONICAL
+ S6_INTC_DMA_LMSPENDCNT(9),
+ S6_INTC_DMA_LMSPENDCNT(10),
+#endif
-1
};

@@ -421,6 +425,15 @@ static struct resource s6_dp_resource[] = {
.start = (resource_size_t)DP_INTNUM,
.flags = IORESOURCE_IRQ,
},
+#ifdef CONFIG_VIDEO_S6000_CANONICAL
+ {
+ .start = (resource_size_t)
+ DMA_CHNL(S6_REG_LMSDMA, 9),
+ .end = (resource_size_t)
+ DMA_CHNL(S6_REG_LMSDMA, 10) + 0x100 - 1,
+ .flags = IORESOURCE_DMA,
+ },
+#endif
};

static struct platform_device platform_devices[] = {
--
1.6.2.107.ge47ee

2009-03-26 14:49:56

by Daniel Glöckner

[permalink] [raw]
Subject: [patch 5/5] xtensa: s6000 video updates for s6105_defconfig

Signed-off-by: Daniel Glöckner <[email protected]>
Signed-off-by: Oskar Schirmer <[email protected]>
---
arch/xtensa/configs/s6105_defconfig | 42 ++++++++++++++++++++++++++++++++--
1 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/arch/xtensa/configs/s6105_defconfig b/arch/xtensa/configs/s6105_defconfig
index 8eec578..8c7a6ec 100644
--- a/arch/xtensa/configs/s6105_defconfig
+++ b/arch/xtensa/configs/s6105_defconfig
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.29-rc7-s6
-# Tue Mar 17 11:55:24 2009
+# Tue Mar 24 14:16:43 2009
#
# CONFIG_FRAME_POINTER is not set
CONFIG_ZONE_DMA=y
@@ -400,6 +400,7 @@ CONFIG_I2C_S6000=y
# CONFIG_SENSORS_PCF8574 is not set
# CONFIG_PCF8575 is not set
# CONFIG_SENSORS_PCA9539 is not set
+CONFIG_PCA9543=y
# CONFIG_SENSORS_PCF8591 is not set
# CONFIG_SENSORS_MAX6875 is not set
# CONFIG_SENSORS_TSL2550 is not set
@@ -483,13 +484,48 @@ CONFIG_SSB_POSSIBLE=y
#
# Multimedia core support
#
-# CONFIG_VIDEO_DEV is not set
+CONFIG_VIDEO_DEV=y
+CONFIG_VIDEO_V4L2_COMMON=y
+# CONFIG_VIDEO_ALLOW_V4L1 is not set
+# CONFIG_VIDEO_V4L1_COMPAT is not set
# CONFIG_DVB_CORE is not set
-# CONFIG_VIDEO_MEDIA is not set
+CONFIG_VIDEO_MEDIA=y

#
# Multimedia drivers
#
+CONFIG_MEDIA_TUNER=y
+CONFIG_MEDIA_TUNER_CUSTOMIZE=y
+# CONFIG_MEDIA_TUNER_SIMPLE is not set
+# CONFIG_MEDIA_TUNER_TDA8290 is not set
+# CONFIG_MEDIA_TUNER_TDA827X is not set
+# CONFIG_MEDIA_TUNER_TDA18271 is not set
+# CONFIG_MEDIA_TUNER_TDA9887 is not set
+# CONFIG_MEDIA_TUNER_TEA5761 is not set
+# CONFIG_MEDIA_TUNER_TEA5767 is not set
+# CONFIG_MEDIA_TUNER_MT20XX is not set
+# CONFIG_MEDIA_TUNER_MT2060 is not set
+# CONFIG_MEDIA_TUNER_MT2266 is not set
+# CONFIG_MEDIA_TUNER_MT2131 is not set
+# CONFIG_MEDIA_TUNER_QT1010 is not set
+# CONFIG_MEDIA_TUNER_XC2028 is not set
+# CONFIG_MEDIA_TUNER_XC5000 is not set
+# CONFIG_MEDIA_TUNER_MXL5005S is not set
+# CONFIG_MEDIA_TUNER_MXL5007T is not set
+CONFIG_VIDEO_V4L2=y
+CONFIG_VIDEO_CAPTURE_DRIVERS=y
+# CONFIG_VIDEO_ADV_DEBUG is not set
+CONFIG_VIDEO_FIXED_MINOR_RANGES=y
+CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
+# CONFIG_VIDEO_VIVI is not set
+# CONFIG_VIDEO_SAA5246A is not set
+# CONFIG_VIDEO_SAA5249 is not set
+CONFIG_VIDEO_S6000=y
+CONFIG_VIDEO_S6000_CANONICAL=y
+CONFIG_VIDEO_S6DP_MT9D131=y
+CONFIG_VIDEO_S6DP_SAA7121=y
+# CONFIG_SOC_CAMERA is not set
+# CONFIG_RADIO_ADAPTERS is not set
# CONFIG_DAB is not set

#
--
1.6.2.107.ge47ee

2009-03-26 14:49:41

by Daniel Glöckner

[permalink] [raw]
Subject: [patch 3/5] xtensa: add mt9d131l demo head to s6105 platform

The mt9d131 is behind a pca9543 which needs to be configured before
we can find the sensor. Our s6_pca9543_callback is called directly
from pca9543_probe, so we may not call i2c_new_device immediately.

If Rodolfo Giometti's multiplexed i2c bus code and pca954x driver
is accepted, most of this patch can be replaced by a simple
i2c_register_board_info call.

Signed-off-by: Daniel Glöckner <[email protected]>
---
arch/xtensa/platforms/s6105/device.c | 35 ++++++++++++++++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/arch/xtensa/platforms/s6105/device.c b/arch/xtensa/platforms/s6105/device.c
index 07fb329..ff047fc 100644
--- a/arch/xtensa/platforms/s6105/device.c
+++ b/arch/xtensa/platforms/s6105/device.c
@@ -207,9 +207,33 @@ static struct s6dp_link s6dp_links[] = {
.is_egress = 1,
.minor = 2,
},
+ {
+ .port_mask = 1 << 3,
+ .is_egress = 0,
+ .minor = 3,
+ },
{ }
};

+static void s6_attach_camera(struct work_struct *ws)
+{
+ struct i2c_board_info mt9d131_bi = {
+ I2C_BOARD_INFO("mt9d131", S6I2C_ADDR_MT9D131),
+ .platform_data = &s6dp_links[1]
+ };
+ i2c_new_device(i2c_get_adapter(0), &mt9d131_bi);
+}
+
+static DECLARE_WORK(s6_attach_camera_work, s6_attach_camera);
+
+static void s6_pca9543_callback(struct i2c_client *client,
+ int (set_switch)(struct i2c_client *, unsigned))
+{
+ set_switch(client, 3);
+ /* i2c_attach_client does not look reentrant */
+ schedule_work(&s6_attach_camera_work);
+}
+
static struct i2c_board_info __initdata s6_i2c_devices[] = {
{
I2C_BOARD_INFO("24c02", S6I2C_ADDR_AT24HC02B),
@@ -221,6 +245,10 @@ static struct i2c_board_info __initdata s6_i2c_devices[] = {
I2C_BOARD_INFO("saa7121", S6I2C_ADDR_SAA7121),
.platform_data = &s6dp_links[0],
},
+ {
+ I2C_BOARD_INFO("pca9543", S6I2C_ADDR_PCA9543),
+ .platform_data = &s6_pca9543_callback
+ },
};

static struct resource s6_isef_resource[] = {
@@ -453,6 +481,13 @@ static int __init device_init(void)
gpio_set_value(GPIO_BP_RESET, 1);
}

+ /* reset MT9D131 */
+ if (!gpio_request(GPIO_IMAGER_RESET, "imager_reset")) {
+ gpio_direction_output(GPIO_IMAGER_RESET, 0);
+ udelay(1);
+ gpio_set_value(GPIO_IMAGER_RESET, 1);
+ }
+
i2c_register_board_info(S6_I2C_BUS_NUM, s6_i2c_devices,
ARRAY_SIZE(s6_i2c_devices));
spi_register_board_info(s6_spi_devices, ARRAY_SIZE(s6_spi_devices));
--
1.6.2.107.ge47ee