All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
To: Geert Uytterhoeven <geert+renesas@glider.be>,
	Magnus Damm <magnus.damm@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	Biju Das <biju.das.jz@bp.renesas.com>,
	Prabhakar <prabhakar.csengg@gmail.com>,
	Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: [PATCH v3 1/2] ARM: dts: r8a7742-iwg21d-q7-dbcm-ca: Separate out ov5640 nodes
Date: Thu, 26 Nov 2020 10:30:52 +0000	[thread overview]
Message-ID: <20201126103053.29881-2-prabhakar.mahadev-lad.rj@bp.renesas.com> (raw)
In-Reply-To: <20201126103053.29881-1-prabhakar.mahadev-lad.rj@bp.renesas.com>

The camera daughter board can also be connected to 8-bit ov7725 sensors,
so in preparation for configurable option to choose depending on the
camera's connected separate out ov5640 nodes in a dtsi file.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 .../boot/dts/r8a7742-iwg21d-q7-dbcm-ca.dts    | 159 +++++++++---------
 .../dts/r8a7742-iwg21d-q7-dbcm-ov5640.dtsi    | 124 ++++++++++++++
 2 files changed, 203 insertions(+), 80 deletions(-)
 create mode 100644 arch/arm/boot/dts/r8a7742-iwg21d-q7-dbcm-ov5640.dtsi

diff --git a/arch/arm/boot/dts/r8a7742-iwg21d-q7-dbcm-ca.dts b/arch/arm/boot/dts/r8a7742-iwg21d-q7-dbcm-ca.dts
index 98c3fbd89fa6..1ab4f9771a34 100644
--- a/arch/arm/boot/dts/r8a7742-iwg21d-q7-dbcm-ca.dts
+++ b/arch/arm/boot/dts/r8a7742-iwg21d-q7-dbcm-ca.dts
@@ -9,6 +9,77 @@
 /dts-v1/;
 #include "r8a7742-iwg21d-q7.dts"
 
+#define SENSOR_NONE		1
+#define SENSOR_OV5640		2
+
+/* 8bit CMOS Camera 1 (J13) */
+#define CAM1_PARENT_I2C		i2c0
+#define MCLK_CAM1		mclk_cam1
+#define VIN0_EP			vin0ep
+
+/* 8bit CMOS Camera 2 (J14) */
+#define CAM2_PARENT_I2C		i2c1
+#define MCLK_CAM2		mclk_cam2
+#define VIN1_EP			vin1ep
+
+/* 8bit CMOS Camera 3 (J12) */
+#define CAM3_PARENT_I2C		i2c2
+#define MCLK_CAM3		mclk_cam3
+#define VIN2_EP			vin2ep
+
+/* 8bit CMOS Camera 4 (J11) */
+#define CAM4_PARENT_I2C		i2c3
+#define MCLK_CAM4		mclk_cam4
+#define VIN3_EP			vin3ep
+
+/*
+ * Below configuration ties VINx endpoints to ov5640_x endpoints
+ *
+ * To disable a VINx set VINx_SENSOR to SENSOR_NONE for example if no
+ * sensor is connected to VIN2 interface set the below (this disables the
+ * VIN2 interface and also the ov5640 node connected to it)
+ *      #define VIN2_SENSOR		SENSOR_NONE
+ *
+ */
+#define VIN0_SENSOR		SENSOR_OV5640
+#define VIN1_SENSOR		SENSOR_OV5640
+#define VIN2_SENSOR		SENSOR_OV5640
+#define VIN3_SENSOR		SENSOR_OV5640
+
+#include "r8a7742-iwg21d-q7-dbcm-ov5640.dtsi"
+
+#if (VIN0_SENSOR == SENSOR_NONE)
+#undef VIN0_REMOTE_EP
+#define VIN0_REMOTE_EP		0
+#define VIN0_STATUS		"disabled"
+#else
+#define VIN0_STATUS		"okay"
+#endif
+
+#if (VIN1_SENSOR == SENSOR_NONE)
+#undef VIN1_REMOTE_EP
+#define VIN1_REMOTE_EP		0
+#define VIN1_STATUS		"disabled"
+#else
+#define VIN1_STATUS		"okay"
+#endif
+
+#if (VIN2_SENSOR == SENSOR_NONE)
+#undef VIN2_REMOTE_EP
+#define VIN2_REMOTE_EP		0
+#define VIN2_STATUS		"disabled"
+#else
+#define VIN2_STATUS		"okay"
+#endif
+
+#if (VIN3_SENSOR == SENSOR_NONE)
+#undef VIN3_REMOTE_EP
+#define VIN3_REMOTE_EP		0
+#define VIN3_STATUS		"disabled"
+#else
+#define VIN3_STATUS		"okay"
+#endif
+
 / {
 	model = "iWave Systems RZ/G1H Qseven development platform with camera add-on";
 	compatible = "iwave,g21d", "iwave,g21m", "renesas,r8a7742";
@@ -91,67 +162,12 @@
 	status = "okay";
 };
 
-&i2c0 {
-	ov5640@3c {
-		compatible = "ovti,ov5640";
-		reg = <0x3c>;
-		clocks = <&mclk_cam1>;
-		clock-names = "xclk";
-
-		port {
-			ov5640_0: endpoint {
-				bus-width = <8>;
-				data-shift = <2>;
-				bus-type = <6>;
-				pclk-sample = <1>;
-				remote-endpoint = <&vin0ep>;
-			};
-		};
-	};
-};
-
 &i2c1 {
 	pinctrl-0 = <&i2c1_pins>;
 	pinctrl-names = "default";
 
 	status = "okay";
 	clock-frequency = <400000>;
-
-	ov5640@3c {
-		compatible = "ovti,ov5640";
-		reg = <0x3c>;
-		clocks = <&mclk_cam2>;
-		clock-names = "xclk";
-
-		port {
-			ov5640_1: endpoint {
-				bus-width = <8>;
-				data-shift = <2>;
-				bus-type = <6>;
-				pclk-sample = <1>;
-				remote-endpoint = <&vin1ep>;
-			};
-		};
-	};
-};
-
-&i2c2 {
-	ov5640@3c {
-		compatible = "ovti,ov5640";
-		reg = <0x3c>;
-		clocks = <&mclk_cam3>;
-		clock-names = "xclk";
-
-		port {
-			ov5640_2: endpoint {
-				bus-width = <8>;
-				data-shift = <2>;
-				bus-type = <6>;
-				pclk-sample = <1>;
-				remote-endpoint = <&vin2ep>;
-			};
-		};
-	};
 };
 
 &i2c3 {
@@ -160,23 +176,6 @@
 
 	status = "okay";
 	clock-frequency = <400000>;
-
-	ov5640@3c {
-		compatible = "ovti,ov5640";
-		reg = <0x3c>;
-		clocks = <&mclk_cam4>;
-		clock-names = "xclk";
-
-		port {
-			ov5640_3: endpoint {
-				bus-width = <8>;
-				data-shift = <2>;
-				bus-type = <6>;
-				pclk-sample = <1>;
-				remote-endpoint = <&vin3ep>;
-			};
-		};
-	};
 };
 
 &pfc {
@@ -272,13 +271,13 @@
 	 * Set SW2 switch on the SOM to 'ON'
 	 * Set SW1 switch on camera board to 'OFF' as we are using 8bit mode
 	 */
-	status = "okay";
+	status = VIN0_STATUS;
 	pinctrl-0 = <&vin0_8bit_pins>;
 	pinctrl-names = "default";
 
 	port {
 		vin0ep: endpoint {
-			remote-endpoint = <&ov5640_0>;
+			remote-endpoint = <VIN0_REMOTE_EP>;
 			bus-width = <8>;
 			bus-type = <6>;
 		};
@@ -287,13 +286,13 @@
 
 &vin1 {
 	/* Set SW1 switch on the SOM to 'ON' */
-	status = "okay";
+	status = VIN1_STATUS;
 	pinctrl-0 = <&vin1_8bit_pins>;
 	pinctrl-names = "default";
 
 	port {
 		vin1ep: endpoint {
-			remote-endpoint = <&ov5640_1>;
+			remote-endpoint = <VIN1_REMOTE_EP>;
 			bus-width = <8>;
 			bus-type = <6>;
 		};
@@ -301,13 +300,13 @@
 };
 
 &vin2 {
-	status = "okay";
+	status = VIN2_STATUS;
 	pinctrl-0 = <&vin2_pins>;
 	pinctrl-names = "default";
 
 	port {
 		vin2ep: endpoint {
-			remote-endpoint = <&ov5640_2>;
+			remote-endpoint = <VIN2_REMOTE_EP>;
 			bus-width = <8>;
 			data-shift = <8>;
 			bus-type = <6>;
@@ -316,13 +315,13 @@
 };
 
 &vin3 {
-	status = "okay";
+	status = VIN3_STATUS;
 	pinctrl-0 = <&vin3_pins>;
 	pinctrl-names = "default";
 
 	port {
 		vin3ep: endpoint {
-			remote-endpoint = <&ov5640_3>;
+			remote-endpoint = <VIN3_REMOTE_EP>;
 			bus-width = <8>;
 			bus-type = <6>;
 		};
diff --git a/arch/arm/boot/dts/r8a7742-iwg21d-q7-dbcm-ov5640.dtsi b/arch/arm/boot/dts/r8a7742-iwg21d-q7-dbcm-ov5640.dtsi
new file mode 100644
index 000000000000..fa2d55f259ec
--- /dev/null
+++ b/arch/arm/boot/dts/r8a7742-iwg21d-q7-dbcm-ov5640.dtsi
@@ -0,0 +1,124 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * This include file ties VIN interfaces with ov5640 sensors on
+ * iWave-RZ/G1H Qseven board development platform connected with
+ * camera daughter board.
+ *
+ * Copyright (C) 2020 Renesas Electronics Corp.
+ */
+
+#if (VIN0_SENSOR == SENSOR_OV5640)
+#define OV5640_0_STATUS		"okay"
+#define OV5640_0_REMOTE_EP	&VIN0_EP
+#define VIN0_REMOTE_EP		&ov5640_0
+#else
+#define OV5640_0_STATUS		"disabled"
+#define OV5640_0_REMOTE_EP	0
+#endif
+
+#if (VIN1_SENSOR == SENSOR_OV5640)
+#define OV5640_1_STATUS		"okay"
+#define OV5640_1_REMOTE_EP	&VIN1_EP
+#define VIN1_REMOTE_EP		&ov5640_1
+#else
+#define OV5640_1_STATUS		"disabled"
+#define OV5640_1_REMOTE_EP	0
+#endif
+
+#if (VIN2_SENSOR == SENSOR_OV5640)
+#define OV5640_2_STATUS		"okay"
+#define OV5640_2_REMOTE_EP	&VIN2_EP
+#define VIN2_REMOTE_EP		&ov5640_2
+#else
+#define OV5640_2_STATUS		"disabled"
+#define OV5640_2_REMOTE_EP	0
+#endif
+
+#if (VIN3_SENSOR == SENSOR_OV5640)
+#define OV5640_3_STATUS		"okay"
+#define OV5640_3_REMOTE_EP	&VIN3_EP
+#define VIN3_REMOTE_EP		&ov5640_3
+#else
+#define OV5640_3_STATUS		"disabled"
+#define OV5640_3_REMOTE_EP	0
+#endif
+
+&CAM1_PARENT_I2C {
+	ov5640@3c {
+		compatible = "ovti,ov5640";
+		reg = <0x3c>;
+		clocks = <&MCLK_CAM1>;
+		clock-names = "xclk";
+		status = OV5640_0_STATUS;
+
+		port {
+			ov5640_0: endpoint {
+				bus-width = <8>;
+				data-shift = <2>;
+				bus-type = <6>;
+				pclk-sample = <1>;
+				remote-endpoint = <OV5640_0_REMOTE_EP>;
+			};
+		};
+	};
+};
+
+&CAM2_PARENT_I2C {
+	ov5640@3c {
+		compatible = "ovti,ov5640";
+		reg = <0x3c>;
+		clocks = <&MCLK_CAM2>;
+		clock-names = "xclk";
+		status = OV5640_1_STATUS;
+
+		port {
+			ov5640_1: endpoint {
+				bus-width = <8>;
+				data-shift = <2>;
+				bus-type = <6>;
+				pclk-sample = <1>;
+				remote-endpoint = <OV5640_1_REMOTE_EP>;
+			};
+		};
+	};
+};
+
+&CAM3_PARENT_I2C {
+	ov5640@3c {
+		compatible = "ovti,ov5640";
+		reg = <0x3c>;
+		clocks = <&MCLK_CAM3>;
+		clock-names = "xclk";
+		status = OV5640_2_STATUS;
+
+		port {
+			ov5640_2: endpoint {
+				bus-width = <8>;
+				data-shift = <2>;
+				bus-type = <6>;
+				pclk-sample = <1>;
+				remote-endpoint = <OV5640_2_REMOTE_EP>;
+			};
+		};
+	};
+};
+
+&CAM4_PARENT_I2C {
+	ov5640@3c {
+		compatible = "ovti,ov5640";
+		reg = <0x3c>;
+		clocks = <&MCLK_CAM4>;
+		clock-names = "xclk";
+		status = OV5640_3_STATUS;
+
+		port {
+			ov5640_3: endpoint {
+				bus-width = <8>;
+				data-shift = <2>;
+				bus-type = <6>;
+				pclk-sample = <1>;
+				remote-endpoint = <OV5640_3_REMOTE_EP>;
+			};
+		};
+	};
+};
-- 
2.17.1


  reply	other threads:[~2020-11-26 10:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-26 10:30 [PATCH v3 0/2] r8a7742-iwg21d-q7-dbcm: Add support for ov7725 sensors Lad Prabhakar
2020-11-26 10:30 ` Lad Prabhakar [this message]
2020-11-26 13:39   ` [PATCH v3 1/2] ARM: dts: r8a7742-iwg21d-q7-dbcm-ca: Separate out ov5640 nodes Geert Uytterhoeven
2020-11-26 10:30 ` [PATCH v3 2/2] ARM: dts: r8a7742-iwg21d-q7-dbcm-ca: Add support for 8-bit ov7725 sensors Lad Prabhakar
2020-11-26 13:39   ` Geert Uytterhoeven
2020-12-15 11:49   ` Jacopo Mondi
2020-12-15 15:57     ` Lad, Prabhakar
2020-12-15 16:27       ` Jacopo Mondi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201126103053.29881-2-prabhakar.mahadev-lad.rj@bp.renesas.com \
    --to=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=devicetree@vger.kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=prabhakar.csengg@gmail.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.