All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/3] arm: shmobile: koelsch: Add I2C support
@ 2013-12-25 19:12 Valentine Barshak
  2013-12-25 19:36 ` [PATCH 3/3] arm: shmobile: koelsch: Add VIN1 SoC camera support Valentine Barshak
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Valentine Barshak @ 2013-12-25 19:12 UTC (permalink / raw)
  To: linux-sh

This adds I2C[1245] busses support to Koelsch board.
I2C[03] do not have any slave devices connected and
are not used because of the following:
* I2C0 pins are multiplexed with LBSC pins;
* I2C3 pins are multiplexed with EtherMAC and VIN0 pins.

Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
---
 arch/arm/mach-shmobile/board-koelsch.c | 46 ++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c
index de7cc64..799825c 100644
--- a/arch/arm/mach-shmobile/board-koelsch.c
+++ b/arch/arm/mach-shmobile/board-koelsch.c
@@ -148,6 +148,38 @@ static const struct gpio_keys_platform_data koelsch_keys_pdata __initconst = {
 	.nbuttons	= ARRAY_SIZE(gpio_buttons),
 };
 
+/* I2C */
+static const struct resource i2c_resources[] __initconst = {
+	/* I2C0 */
+	DEFINE_RES_MEM(0xE6508000, 0x40),
+	DEFINE_RES_IRQ(gic_spi(287)),
+	/* I2C1 */
+	DEFINE_RES_MEM(0xE6518000, 0x40),
+	DEFINE_RES_IRQ(gic_spi(288)),
+	/* I2C2 */
+	DEFINE_RES_MEM(0xE6530000, 0x40),
+	DEFINE_RES_IRQ(gic_spi(286)),
+	/* I2C3 */
+	DEFINE_RES_MEM(0xE6540000, 0x40),
+	DEFINE_RES_IRQ(gic_spi(290)),
+	/* I2C4 */
+	DEFINE_RES_MEM(0xE6520000, 0x40),
+	DEFINE_RES_IRQ(gic_spi(19)),
+	/* I2C5 */
+	DEFINE_RES_MEM(0xE6528000, 0x40),
+	DEFINE_RES_IRQ(gic_spi(20)),
+};
+
+static void __init koelsch_add_i2c(unsigned idx)
+{
+	unsigned res_idx = idx * 2;
+
+	BUG_ON(res_idx >= ARRAY_SIZE(i2c_resources));
+
+	platform_device_register_simple("i2c-rcar_gen2", idx,
+					i2c_resources + res_idx, 2);
+}
+
 static const struct pinctrl_map koelsch_pinctrl_map[] = {
 	/* DU */
 	PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7791", "pfc-r8a7791",
@@ -171,6 +203,15 @@ static const struct pinctrl_map koelsch_pinctrl_map[] = {
 	/* SCIF1 (CN20: DEBUG SERIAL1) */
 	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.7", "pfc-r8a7791",
 				  "scif1_data_d", "scif1"),
+	/* I2C1 */
+	PIN_MAP_MUX_GROUP_DEFAULT("i2c-rcar_gen2.1", "pfc-r8a7791",
+				  "i2c1_e", "i2c1"),
+	/* I2C2 */
+	PIN_MAP_MUX_GROUP_DEFAULT("i2c-rcar_gen2.2", "pfc-r8a7791",
+				  "i2c2", "i2c2"),
+	/* I2C4 */
+	PIN_MAP_MUX_GROUP_DEFAULT("i2c-rcar_gen2.4", "pfc-r8a7791",
+				  "i2c4_c", "i2c4"),
 };
 
 static void __init koelsch_add_standard_devices(void)
@@ -192,6 +233,11 @@ static void __init koelsch_add_standard_devices(void)
 				      sizeof(koelsch_keys_pdata));
 
 	koelsch_add_du_device();
+
+	koelsch_add_i2c(1);
+	koelsch_add_i2c(2);
+	koelsch_add_i2c(4);
+	koelsch_add_i2c(5);
 }
 
 /*
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] arm: shmobile: koelsch: Add VIN1 SoC camera support
  2013-12-25 19:12 [PATCH 3/3] arm: shmobile: koelsch: Add I2C support Valentine Barshak
@ 2013-12-25 19:36 ` Valentine Barshak
  2013-12-26 14:23 ` Laurent Pinchart
  2015-02-26  9:21 ` [PATCH 3/3] ARM: shmobile: koelsch: Add DU external pixel clocks to DT Laurent Pinchart
  2 siblings, 0 replies; 4+ messages in thread
From: Valentine Barshak @ 2013-12-25 19:36 UTC (permalink / raw)
  To: linux-sh

This adds VIN1 SoC camera along with ADV7180 subdevice support to Koelsch.
VIN0 camera is not registered because it has ADV7612 I2C subdevice
which is not supported yet.

Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
---
 arch/arm/mach-shmobile/board-koelsch.c | 76 ++++++++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)

diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c
index 799825c..a7fd27b 100644
--- a/arch/arm/mach-shmobile/board-koelsch.c
+++ b/arch/arm/mach-shmobile/board-koelsch.c
@@ -27,6 +27,7 @@
 #include <linux/leds.h>
 #include <linux/phy.h>
 #include <linux/pinctrl/machine.h>
+#include <linux/platform_data/camera-rcar.h>
 #include <linux/platform_data/gpio-rcar.h>
 #include <linux/platform_data/rcar-du.h>
 #include <linux/platform_device.h>
@@ -35,6 +36,7 @@
 #include <mach/irqs.h>
 #include <mach/r8a7791.h>
 #include <mach/rcar-gen2.h>
+#include <media/soc_camera.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 
@@ -180,6 +182,62 @@ static void __init koelsch_add_i2c(unsigned idx)
 					i2c_resources + res_idx, 2);
 }
 
+/* VIN */
+static const struct resource vin_resources[] __initconst = {
+	/* VIN0 */
+	DEFINE_RES_MEM(0xe6ef0000, 0x1000),
+	DEFINE_RES_IRQ(gic_spi(188)),
+	/* VIN1 */
+	DEFINE_RES_MEM(0xe6ef1000, 0x1000),
+	DEFINE_RES_IRQ(gic_spi(189)),
+};
+
+void __init koelsch_add_vin_device(unsigned idx,
+				   struct rcar_vin_platform_data *pdata)
+{
+	struct platform_device_info vin_info = {
+		.parent		= &platform_bus,
+		.name		= "r8a7791-vin",
+		.id		= idx,
+		.res		= &vin_resources[idx * 2],
+		.num_res	= 2,
+		.dma_mask	= DMA_BIT_MASK(32),
+		.data		= pdata,
+		.size_data	= sizeof(*pdata),
+	};
+
+	BUG_ON(idx > 1);
+
+	platform_device_register_full(&vin_info);
+}
+
+#define KOELSCH_CAMERA(idx, name, addr, pdata, flag)			\
+static struct i2c_board_info i2c_cam##idx##_device = {			\
+	I2C_BOARD_INFO(name, addr),					\
+};									\
+									\
+static struct rcar_vin_platform_data vin##idx##_pdata = {		\
+	.flags = flag,							\
+};									\
+									\
+static struct soc_camera_link cam##idx##_link = {			\
+	.bus_id = idx,							\
+	.board_info = &i2c_cam##idx##_device,				\
+	.i2c_adapter_id = 2,						\
+	.module_name = name,						\
+	.priv = pdata,							\
+}
+
+/* Camera 0 is not currently supported due to adv7612 support missing */
+KOELSCH_CAMERA(1, "adv7180", 0x20, NULL, RCAR_VIN_BT656);
+
+static void __init koelsch_add_camera1_device(void)
+{
+	platform_device_register_data(&platform_bus, "soc-camera-pdrv", 1,
+				      &cam1_link, sizeof(cam1_link));
+	koelsch_add_vin_device(1, &vin1_pdata);
+}
+
 static const struct pinctrl_map koelsch_pinctrl_map[] = {
 	/* DU */
 	PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7791", "pfc-r8a7791",
@@ -212,6 +270,22 @@ static const struct pinctrl_map koelsch_pinctrl_map[] = {
 	/* I2C4 */
 	PIN_MAP_MUX_GROUP_DEFAULT("i2c-rcar_gen2.4", "pfc-r8a7791",
 				  "i2c4_c", "i2c4"),
+	/* VIN0 */
+	PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-vin.0", "pfc-r8a7791",
+				  "vin0_data24", "vin0"),
+	PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-vin.0", "pfc-r8a7791",
+				  "vin0_sync", "vin0"),
+	PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-vin.0", "pfc-r8a7791",
+				  "vin0_field", "vin0"),
+	PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-vin.0", "pfc-r8a7791",
+				  "vin0_clkenb", "vin0"),
+	PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-vin.0", "pfc-r8a7791",
+				  "vin0_clk", "vin0"),
+	/* VIN1 */
+	PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-vin.1", "pfc-r8a7791",
+				  "vin1_data8", "vin1"),
+	PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-vin.1", "pfc-r8a7791",
+				  "vin1_clk", "vin1"),
 };
 
 static void __init koelsch_add_standard_devices(void)
@@ -238,6 +312,8 @@ static void __init koelsch_add_standard_devices(void)
 	koelsch_add_i2c(2);
 	koelsch_add_i2c(4);
 	koelsch_add_i2c(5);
+
+	koelsch_add_camera1_device();
 }
 
 /*
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/3] arm: shmobile: koelsch: Add VIN1 SoC camera support
  2013-12-25 19:12 [PATCH 3/3] arm: shmobile: koelsch: Add I2C support Valentine Barshak
  2013-12-25 19:36 ` [PATCH 3/3] arm: shmobile: koelsch: Add VIN1 SoC camera support Valentine Barshak
@ 2013-12-26 14:23 ` Laurent Pinchart
  2015-02-26  9:21 ` [PATCH 3/3] ARM: shmobile: koelsch: Add DU external pixel clocks to DT Laurent Pinchart
  2 siblings, 0 replies; 4+ messages in thread
From: Laurent Pinchart @ 2013-12-26 14:23 UTC (permalink / raw)
  To: linux-sh

Hi Valentine,

Thank you for the patch.

On Wednesday 25 December 2013 23:36:03 Valentine Barshak wrote:
> This adds VIN1 SoC camera along with ADV7180 subdevice support to Koelsch.
> VIN0 camera is not registered because it has ADV7612 I2C subdevice
> which is not supported yet.
> 
> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
> ---
>  arch/arm/mach-shmobile/board-koelsch.c | 76 +++++++++++++++++++++++++++++++
>  1 file changed, 76 insertions(+)
> 
> diff --git a/arch/arm/mach-shmobile/board-koelsch.c
> b/arch/arm/mach-shmobile/board-koelsch.c index 799825c..a7fd27b 100644
> --- a/arch/arm/mach-shmobile/board-koelsch.c
> +++ b/arch/arm/mach-shmobile/board-koelsch.c
> @@ -27,6 +27,7 @@
>  #include <linux/leds.h>
>  #include <linux/phy.h>
>  #include <linux/pinctrl/machine.h>
> +#include <linux/platform_data/camera-rcar.h>
>  #include <linux/platform_data/gpio-rcar.h>
>  #include <linux/platform_data/rcar-du.h>
>  #include <linux/platform_device.h>
> @@ -35,6 +36,7 @@
>  #include <mach/irqs.h>
>  #include <mach/r8a7791.h>
>  #include <mach/rcar-gen2.h>
> +#include <media/soc_camera.h>
>  #include <asm/mach-types.h>
>  #include <asm/mach/arch.h>
> 
> @@ -180,6 +182,62 @@ static void __init koelsch_add_i2c(unsigned idx)
>  					i2c_resources + res_idx, 2);
>  }
> 
> +/* VIN */
> +static const struct resource vin_resources[] __initconst = {
> +	/* VIN0 */
> +	DEFINE_RES_MEM(0xe6ef0000, 0x1000),
> +	DEFINE_RES_IRQ(gic_spi(188)),
> +	/* VIN1 */
> +	DEFINE_RES_MEM(0xe6ef1000, 0x1000),
> +	DEFINE_RES_IRQ(gic_spi(189)),
> +};
> +
> +void __init koelsch_add_vin_device(unsigned idx,
> +				   struct rcar_vin_platform_data *pdata)

As for the Lager patch, you can make this function static.

> +{
> +	struct platform_device_info vin_info = {
> +		.parent		= &platform_bus,
> +		.name		= "r8a7791-vin",
> +		.id		= idx,
> +		.res		= &vin_resources[idx * 2],
> +		.num_res	= 2,
> +		.dma_mask	= DMA_BIT_MASK(32),
> +		.data		= pdata,
> +		.size_data	= sizeof(*pdata),
> +	};
> +
> +	BUG_ON(idx > 1);
> +
> +	platform_device_register_full(&vin_info);
> +}
> +
> +#define KOELSCH_CAMERA(idx, name, addr, pdata, flag)			\
> +static struct i2c_board_info i2c_cam##idx##_device = {			\
> +	I2C_BOARD_INFO(name, addr),					\
> +};									\
> +									\
> +static struct rcar_vin_platform_data vin##idx##_pdata = {		\
> +	.flags = flag,							\
> +};									\
> +									\
> +static struct soc_camera_link cam##idx##_link = {			\
> +	.bus_id = idx,							\
> +	.board_info = &i2c_cam##idx##_device,				\
> +	.i2c_adapter_id = 2,						\
> +	.module_name = name,						\
> +	.priv = pdata,							\
> +}
> +
> +/* Camera 0 is not currently supported due to adv7612 support missing */
> +KOELSCH_CAMERA(1, "adv7180", 0x20, NULL, RCAR_VIN_BT656);
> +
> +static void __init koelsch_add_camera1_device(void)
> +{
> +	platform_device_register_data(&platform_bus, "soc-camera-pdrv", 1,
> +				      &cam1_link, sizeof(cam1_link));
> +	koelsch_add_vin_device(1, &vin1_pdata);
> +}
> +
>  static const struct pinctrl_map koelsch_pinctrl_map[] = {
>  	/* DU */
>  	PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7791", "pfc-r8a7791",
> @@ -212,6 +270,22 @@ static const struct pinctrl_map koelsch_pinctrl_map[] > { /* I2C4 */
>  	PIN_MAP_MUX_GROUP_DEFAULT("i2c-rcar_gen2.4", "pfc-r8a7791",
>  				  "i2c4_c", "i2c4"),
> +	/* VIN0 */
> +	PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-vin.0", "pfc-r8a7791",
> +				  "vin0_data24", "vin0"),
> +	PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-vin.0", "pfc-r8a7791",
> +				  "vin0_sync", "vin0"),
> +	PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-vin.0", "pfc-r8a7791",
> +				  "vin0_field", "vin0"),
> +	PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-vin.0", "pfc-r8a7791",
> +				  "vin0_clkenb", "vin0"),
> +	PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-vin.0", "pfc-r8a7791",
> +				  "vin0_clk", "vin0"),
> +	/* VIN1 */
> +	PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-vin.1", "pfc-r8a7791",
> +				  "vin1_data8", "vin1"),
> +	PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-vin.1", "pfc-r8a7791",
> +				  "vin1_clk", "vin1"),
>  };
> 
>  static void __init koelsch_add_standard_devices(void)
> @@ -238,6 +312,8 @@ static void __init koelsch_add_standard_devices(void)
>  	koelsch_add_i2c(2);
>  	koelsch_add_i2c(4);
>  	koelsch_add_i2c(5);
> +
> +	koelsch_add_camera1_device();
>  }
> 
>  /*
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/3] ARM: shmobile: koelsch: Add DU external pixel clocks to DT
  2013-12-25 19:12 [PATCH 3/3] arm: shmobile: koelsch: Add I2C support Valentine Barshak
  2013-12-25 19:36 ` [PATCH 3/3] arm: shmobile: koelsch: Add VIN1 SoC camera support Valentine Barshak
  2013-12-26 14:23 ` Laurent Pinchart
@ 2015-02-26  9:21 ` Laurent Pinchart
  2 siblings, 0 replies; 4+ messages in thread
From: Laurent Pinchart @ 2015-02-26  9:21 UTC (permalink / raw)
  To: linux-sh

Declare the fixed 148.5MHz pixel clocks connected to the DU clock
inputs.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 arch/arm/boot/dts/r8a7791-koelsch.dts | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts b/arch/arm/boot/dts/r8a7791-koelsch.dts
index 624bb2c30513..75fa9852e235 100644
--- a/arch/arm/boot/dts/r8a7791-koelsch.dts
+++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
@@ -269,6 +269,18 @@
 			};
 		};
 	};
+
+	x2_clk: x2-clock {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <148500000>;
+	};
+
+	x13_clk: x13-clock {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <148500000>;
+	};
 };
 
 &du {
@@ -276,6 +288,13 @@
 	pinctrl-names = "default";
 	status = "okay";
 
+	clocks = <&mstp7_clks R8A7791_CLK_DU0>,
+		 <&mstp7_clks R8A7791_CLK_DU1>,
+		 <&mstp7_clks R8A7791_CLK_LVDS0>,
+		 <&x13_clk>, <&x2_clk>;
+	clock-names = "du.0", "du.1", "lvds.0",
+		      "dclkin.0", "dclkin.1";
+
 	ports {
 		port@0 {
 			endpoint {
-- 
2.0.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-26  9:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-25 19:12 [PATCH 3/3] arm: shmobile: koelsch: Add I2C support Valentine Barshak
2013-12-25 19:36 ` [PATCH 3/3] arm: shmobile: koelsch: Add VIN1 SoC camera support Valentine Barshak
2013-12-26 14:23 ` Laurent Pinchart
2015-02-26  9:21 ` [PATCH 3/3] ARM: shmobile: koelsch: Add DU external pixel clocks to DT Laurent Pinchart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.