Skip to contentSkip to conversation

r8a77990 VIN prototype

PATCH In review Magnus Damm 2 participants 6 messages Jun 19, 2018 – Jun 27, 2018

Subsystems (3)
lore
Share & tools
lore

Magnus Damm

author maintainer
#0 lore raw

cover r8a77990 VIN prototype

r8a77990 VIN prototype

[PATCH 01/04] rcar-vin: r8a77990 prototype
[PATCH 02/04] arm64: dts: renesas: r8a77990: add VIN and CSI-2 nodes [PATCH 03/04] arm64: dts: renesas: r8a77990: hook up I2C0 [PATCH 03/04] arm64: dts: renesas: ebisu: add adv7482 support

This series attempts to add VIN prototype support to r8a77990 Ebisu.

Patch 1 extends the VIN and CSI drivers with experimental r8a77990 support Patch 2 adds VIN4, VIN5 and CSI nodes
Patch 3 temporarily hooks up I2C0
Patch 4 connects the ADV7482 to the VIN via CSI and I2C0

The DT bindings are not extended yet and in-flight patches for r8a77995 should most likely get merged before this series so future rebase will most likely be needed.

---

Fits on top of renesas-drivers-2018-06-05-v4.17

 arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts |   91 +++++++++++++++++++++
 arch/arm64/boot/dts/renesas/r8a77990.dtsi      |  103 ++++++++++++++++++++++++
 drivers/media/platform/rcar-vin/rcar-core.c    |   21 ++++
 drivers/media/platform/rcar-vin/rcar-csi2.c    |    8 +
 4 files changed, 223 insertions(+)
author maintainer
#1 lore raw

PATCH 1/4 rcar-vin: r8a77990 prototype

From: Magnus Damm <[email protected]>

Extend the VIN driver with experimental r8a77990 support.

---

 drivers/media/platform/rcar-vin/rcar-core.c |   21 +++++++++++++++++++++
 drivers/media/platform/rcar-vin/rcar-csi2.c |    8 ++++++++
 2 files changed, 29 insertions(+)
drivers/media/platform/rcar-vin/rcar-core.c +21 -0
@@ -1037,6 +1037,23 @@ static const struct rvin_info rcar_info_
 	.routes = _rcar_info_r8a77970_routes,
 };
 
+
+static const struct rvin_group_route _rcar_info_r8a77990_routes[] = {
+	{ .csi = RVIN_CSI40, .channel = 0, .vin = 4, .mask = BIT(0) | BIT(3) },
+	{ .csi = RVIN_CSI40, .channel = 0, .vin = 5, .mask = BIT(2) },
+	{ .csi = RVIN_CSI40, .channel = 1, .vin = 4, .mask = BIT(2) },
+	{ .csi = RVIN_CSI40, .channel = 1, .vin = 5, .mask = BIT(1) | BIT(3) },
+	{ /* Sentinel */ }
+};
+
+static const struct rvin_info rcar_info_r8a77990 = {
+	.model = RCAR_GEN3,
+	.use_mc = true,
+	.max_width = 4096,
+	.max_height = 4096,
+	.routes = _rcar_info_r8a77990_routes,
+};
+
 static const struct of_device_id rvin_of_id_table[] = {
 	{
 		.compatible = "renesas,vin-r8a7778",
@@ -1082,6 +1099,10 @@ static const struct of_device_id rvin_of
 		.compatible = "renesas,vin-r8a77970",
 		.data = &rcar_info_r8a77970,
 	},
+	{
+		.compatible = "renesas,vin-r8a77990",
+		.data = &rcar_info_r8a77990,
+	},
 	{ /* Sentinel */ },
 };
 MODULE_DEVICE_TABLE(of, rvin_of_id_table);
drivers/media/platform/rcar-vin/rcar-csi2.c +8 -0
@@ -951,6 +951,10 @@ static const struct rcar_csi2_info rcar_
 	.init_phtw = rcsi2_init_phtw_v3m_e3,
 };
 
+static const struct rcar_csi2_info rcar_csi2_info_r8a77990 = {
+	.init_phtw = rcsi2_init_phtw_v3m_e3,
+};
+
 static const struct of_device_id rcar_csi2_of_table[] = {
 	{
 		.compatible = "renesas,r8a7795-csi2",
@@ -968,6 +972,10 @@ static const struct of_device_id rcar_cs
 		.compatible = "renesas,r8a77970-csi2",
 		.data = &rcar_csi2_info_r8a77970,
 	},
+	{
+		.compatible = "renesas,r8a77990-csi2",
+		.data = &rcar_csi2_info_r8a77990,
+	},
 	{ /* sentinel */ },
 };
 MODULE_DEVICE_TABLE(of, rcar_csi2_of_table);
#2 lore raw

Re: [PATCH 01/04] rcar-vin: r8a77990 prototype

Hi Magnus,

Thanks for your patch.

Quoted 14 lines · Magnus Damm

From: Magnus Damm <[email protected]>

Extend the VIN driver with experimental r8a77990 support.

---

 drivers/media/platform/rcar-vin/rcar-core.c |   21 +++++++++++++++++++++
 drivers/media/platform/rcar-vin/rcar-csi2.c |    8 ++++++++
 2 files changed, 29 insertions(+)

drivers/media/platform/rcar-vin/rcar-core.c static const struct rvin_info rcar_info_ · line 1041

Quoted 5 lines
drivers/media/platform/rcar-vin/rcar-core.c +2 -0
@@ -1037,6 +1037,23 @@ static const struct rvin_info rcar_info_
 	.routes = _rcar_info_r8a77970_routes,
 };
 
+
+static const struct rvin_group_route _rcar_info_r8a77990_routes[] = {

Please drop the leading _. I did a bad copy past error when adding support for r8a77970 which included the leading _ for the route tables. We are trying to correct this mistake upstream but in the mean time we should not let it spread :-)

Quoted 19 lines
drivers/media/platform/rcar-vin/rcar-core.c +15 -0
+	{ .csi = RVIN_CSI40, .channel = 0, .vin = 4, .mask = BIT(0) | BIT(3) },
+	{ .csi = RVIN_CSI40, .channel = 0, .vin = 5, .mask = BIT(2) },
+	{ .csi = RVIN_CSI40, .channel = 1, .vin = 4, .mask = BIT(2) },
+	{ .csi = RVIN_CSI40, .channel = 1, .vin = 5, .mask = BIT(1) | BIT(3) },
+	{ /* Sentinel */ }
+};
+
+static const struct rvin_info rcar_info_r8a77990 = {
+	.model = RCAR_GEN3,
+	.use_mc = true,
+	.max_width = 4096,
+	.max_height = 4096,
+	.routes = _rcar_info_r8a77990_routes,
+};
+
 static const struct of_device_id rvin_of_id_table[] = {
 	{
 		.compatible = "renesas,vin-r8a7778",

drivers/media/platform/rcar-vin/rcar-core.c static const struct of_device_id rvin_of · line 1103

Quoted 5 lines
drivers/media/platform/rcar-vin/rcar-core.c +2 -0
@@ -1082,6 +1099,10 @@ static const struct of_device_id rvin_of
 		.compatible = "renesas,vin-r8a77970",
 		.data = &rcar_info_r8a77970,
 	},
+	{
+		.compatible = "renesas,vin-r8a77990",

The compatible value also needs to be added to the bindings documentation.

drivers/media/platform/rcar-vin/rcar-csi2.c

Quoted 7 lines
drivers/media/platform/rcar-vin/rcar-core.c +2 -0
+		.data = &rcar_info_r8a77990,
+	},
 	{ /* Sentinel */ },
 };
 MODULE_DEVICE_TABLE(of, rvin_of_id_table);
drivers/media/platform/rcar-vin/rcar-csi2.c +0 -0

I would split this into a separate patch as VIN and CSI-2 are two separate drivers.

Quoted 12 lines
drivers/media/platform/rcar-vin/rcar-csi2.c +4 -0
@@ -951,6 +951,10 @@ static const struct rcar_csi2_info rcar_
 	.init_phtw = rcsi2_init_phtw_v3m_e3,
 };
 
+static const struct rcar_csi2_info rcar_csi2_info_r8a77990 = {
+	.init_phtw = rcsi2_init_phtw_v3m_e3,
+};
+
 static const struct of_device_id rcar_csi2_of_table[] = {
 	{
 		.compatible = "renesas,r8a7795-csi2",

drivers/media/platform/rcar-vin/rcar-csi2.c static const struct of_device_id rcar_cs · line 976

Quoted 5 lines
drivers/media/platform/rcar-vin/rcar-csi2.c +2 -0
@@ -968,6 +972,10 @@ static const struct of_device_id rcar_cs
 		.compatible = "renesas,r8a77970-csi2",
 		.data = &rcar_csi2_info_r8a77970,
 	},
+	{
+		.compatible = "renesas,r8a77990-csi2",

Same with this compatible string.

Quoted 5 lines
drivers/media/platform/rcar-vin/rcar-csi2.c +2 -0
+		.data = &rcar_csi2_info_r8a77990,
+	},
 	{ /* sentinel */ },
 };
 MODULE_DEVICE_TABLE(of, rcar_csi2_of_table);
Signature · 2 lines
Regards,
Niklas S�derlund
author maintainer
#3 lore raw

PATCH 2/4 arm64: dts: renesas: r8a77990: add VIN and CSI-2 nodes

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Add VIN and CSI device nodes to the r8a77990 dtsi file.

---

 arch/arm64/boot/dts/renesas/r8a77990.dtsi |   89 +++++++++++++++++++++++++++++
 1 file changed, 89 insertions(+)
arch/arm64/boot/dts/renesas/r8a77990.dtsi +89 -0
@@ -248,6 +248,63 @@
 			status = "disabled";
 		};
 
+		vin4: video@e6ef4000 {
+			compatible = "renesas,vin-r8a77990";
+			reg = <0 0xe6ef4000 0 0x1000>;
+			interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 807>;
+			power-domains = <&sysc 32>;
+			resets = <&cpg 807>;
+			renesas,id = <4>;
+			status = "disabled";
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				port@1 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+
+					reg = <1>;
+
+					vin4csi40: endpoint@0 {
+						reg = <0>;
+						remote-endpoint= <&csi40vin4>;
+					};
+				};
+			};
+		};
+
+		vin5: video@e6ef5000 {
+			compatible = "renesas,vin-r8a77990";
+			reg = <0 0xe6ef5000 0 0x1000>;
+			interrupts = <GIC_SPI 175 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 806>;
+			power-domains = <&sysc 32>;
+			resets = <&cpg 806>;
+			renesas,id = <5>;
+			status = "disabled";
+
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				port@1 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+
+					reg = <1>;
+
+					vin5csi40: endpoint@0 {
+						reg = <0>;
+						remote-endpoint= <&csi40vin5>;
+					};
+				};
+			};
+		};
+
 		gic: interrupt-controller@f1010000 {
 			compatible = "arm,gic-400";
 			#interrupt-cells = <3>;
@@ -265,6 +322,38 @@
 			resets = <&cpg 408>;
 		};
 
+
+		csi40: csi2@feaa0000 {
+			compatible = "renesas,r8a77990-csi2";
+			reg = <0 0xfeaa0000 0 0x10000>;
+			interrupts = <GIC_SPI 246 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 716>;
+			power-domains = <&sysc 32>;
+			resets = <&cpg 716>;
+			status = "disabled";
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				port@1 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+
+					reg = <1>;
+
+					csi40vin4: endpoint@0 {
+						reg = <0>;
+						remote-endpoint = <&vin4csi40>;
+					};
+					csi40vin5: endpoint@1 {
+						reg = <1>;
+						remote-endpoint = <&vin5csi40>;
+					};
+				};
+			};
+		};
+
 		prr: chipid@fff00044 {
 			compatible = "renesas,prr";
 			reg = <0 0xfff00044 0 4>;
author maintainer
#4 lore raw

PATCH 3/4 arm64: dts: renesas: r8a77990: hook up I2C0

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

A hack to add I2C0 on r8a77990. This is needed to hook up the video decoder.

---

 arch/arm64/boot/dts/renesas/r8a77990.dtsi |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm64/boot/dts/renesas/r8a77990.dtsi +14 -0
@@ -191,6 +191,20 @@
 			#power-domain-cells = <1>;
 		};
 
+		i2c0: i2c@e6500000 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			compatible = "renesas,i2c-r8a77990",
+				     "renesas,rcar-gen3-i2c";
+			reg = <0 0xe6500000 0 0x40>;
+			interrupts = <GIC_SPI 287 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 931>;
+			power-domains = <&sysc 32>;
+			resets = <&cpg 931>;
+			i2c-scl-internal-delay-ns = <110>;
+			status = "disabled";
+		};
+
 		avb: ethernet@e6800000 {
 			compatible = "renesas,etheravb-r8a77990",
 				     "renesas,etheravb-rcar-gen3";
author maintainer
#5 lore raw

PATCH 3/4 arm64: dts: renesas: ebisu: add adv7482 support

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Add experimental support for ADV7482 on the r8a77990 Ebisu board.

---

 arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts |   91 ++++++++++++++++++++++++
 1 file changed, 91 insertions(+)
arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts +91 -0
@@ -28,6 +28,30 @@
 		/* first 128MB is reserved for secure area. */
 		reg = <0x0 0x48000000 0x0 0x38000000>;
 	};
+
+	cvbs-in {
+		compatible = "composite-video-connector";
+		label = "CVBS IN";
+
+		port {
+			cvbs_con: endpoint {
+				remote-endpoint = <&adv7482_ain7>;
+			};
+		};
+	};
+
+	hdmi-in {
+		compatible = "hdmi-connector";
+		label = "HDMI IN";
+		type = "a";
+
+		port {
+			hdmi_in_con: endpoint {
+				remote-endpoint = <&adv7482_hdmi>;
+			};
+		};
+	};
+
 };
 
 &avb {
@@ -47,6 +71,65 @@
 	};
 };
 
+&csi40 {
+	status = "okay";
+
+	ports {
+		port@0 {
+			reg = <0>;
+
+			csi40_in: endpoint {
+				clock-lanes = <0>;
+				data-lanes = <1 2>;
+				remote-endpoint = <&adv7482_txa>;
+			};
+		};
+	};
+};
+
+&i2c0 {
+	status = "okay";
+
+	video-receiver@70 {
+		compatible = "adi,adv7482";
+		reg = <0x70>;
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		interrupt-parent = <&gpio0>;
+		interrupt-names = "intrq1", "intrq2";
+		interrupts = <7 IRQ_TYPE_LEVEL_LOW>,
+			     <17 IRQ_TYPE_LEVEL_LOW>;
+
+		port@7 {
+			reg = <7>;
+
+			adv7482_ain7: endpoint {
+				remote-endpoint = <&cvbs_con>;
+			};
+		};
+
+		port@8 {
+			reg = <8>;
+
+			adv7482_hdmi: endpoint {
+				remote-endpoint = <&hdmi_in_con>;
+			};
+		};
+
+		port@10 {
+			reg = <10>;
+
+			adv7482_txa: endpoint {
+				clock-lanes = <0>;
+				data-lanes = <1 2>;
+				remote-endpoint = <&csi40_in>;
+			};
+		};
+	};
+};
+
 &extal_clk {
 	clock-frequency = <48000000>;
 };
@@ -63,3 +146,11 @@
 &scif2 {
 	status = "okay";
 };
+
+&vin4 {
+	status = "okay";
+};
+
+&vin5 {
+	status = "okay";
+};