2021-02-15 17:44:03

by Jacopo Mondi

[permalink] [raw]
Subject: [PATCH 0/4] arm64: dts: renesas: Enable GMSL on R8A77970 V3M Eagle

Hello,
this series adds a .dtsi fragment that allow to describe and
enable GMSL cameras on the V3M Eagle board.

The .dtsi supports connecting the RDACM20 and RDACM21 cameras to the
FAKRA connectors installed on the board.

Tested on V3M Eagle with RDACM20 and RDACM21 (a series is pending submission
for the RDACM20 camera module to support operations on the Eagle board)

Thanks
j

Jacopo Mondi (1):
dt-bindings: media: max9286: Describe gpio-hog

Kieran Bingham (3):
arm64: dts: renesas: eagle: Enable MAX9286
arm64: dts: renesas: eagle: Add GMSL .dtsi
arm64: dts: renesas: eagle: Include eagle-gmsl

.../bindings/media/i2c/maxim,max9286.yaml | 9 +
arch/arm64/boot/dts/renesas/eagle-gmsl.dtsi | 186 ++++++++++++++++++
.../arm64/boot/dts/renesas/r8a77970-eagle.dts | 135 +++++++++++++
3 files changed, 330 insertions(+)
create mode 100644 arch/arm64/boot/dts/renesas/eagle-gmsl.dtsi

--
2.30.0


2021-02-15 17:44:39

by Jacopo Mondi

[permalink] [raw]
Subject: [PATCH 1/4] dt-bindings: media: max9286: Describe gpio-hog

The MAX9286 GMSL deserializer features gpio controller capabilities,
as it provides 2 GPIO lines.

As establishing a regulator that uses one of the GPIO lines and
enabling/disabling it at run-time in the max9286 won't work due to
a circular dependency on the gpio-controller/regulator creation, allow
the usage of a gpio-hog for that purpose.

The usage of the gpio-hog is required in designs where the MAX9286
GPIO lines control the remote cameras power.

Signed-off-by: Jacopo Mondi <[email protected]>
---
.../devicetree/bindings/media/i2c/maxim,max9286.yaml | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml b/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml
index ee16102fdfe7..9d5ecfd2397c 100644
--- a/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml
+++ b/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml
@@ -50,6 +50,15 @@ properties:
'#gpio-cells':
const: 2

+ camvdd_en:
+ type: object
+ properties:
+ gpio-hog: true
+ gpios: true
+ output-low: true
+ line-name:
+ const: "CAMVDD_EN"
+
maxim,reverse-channel-microvolt:
minimum: 30000
maximum: 200000
--
2.30.0

2021-02-15 17:45:33

by Jacopo Mondi

[permalink] [raw]
Subject: [PATCH 3/4] arm64: dts: renesas: eagle: Add GMSL .dtsi

From: Kieran Bingham <[email protected]>

Describe the FAKRA connector available on Eagle board that allows
connecting GMSL camera modules such as IMI RDACM20 and RDACM21.

Signed-off-by: Kieran Bingham <[email protected]>
Signed-off-by: Jacopo Mondi <[email protected]>
---
arch/arm64/boot/dts/renesas/eagle-gmsl.dtsi | 186 ++++++++++++++++++++
1 file changed, 186 insertions(+)
create mode 100644 arch/arm64/boot/dts/renesas/eagle-gmsl.dtsi

diff --git a/arch/arm64/boot/dts/renesas/eagle-gmsl.dtsi b/arch/arm64/boot/dts/renesas/eagle-gmsl.dtsi
new file mode 100644
index 000000000000..ec3e7493aa71
--- /dev/null
+++ b/arch/arm64/boot/dts/renesas/eagle-gmsl.dtsi
@@ -0,0 +1,186 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Device Tree Source (overlay) for the Eagle V3M GMSL connectors
+ *
+ * Copyright (C) 2017 Ideas on Board <[email protected]>
+ * Copyright (C) 2021 Jacopo Mondi <[email protected]>
+ *
+ * This overlay allows you to define GMSL cameras connected to the FAKRA
+ * connectors on the Eagle-V3M (or compatible) board.
+ *
+ * The following cameras are currently supported:
+ * "imi,rdacm20"
+ * "imi,rdacm21"
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+
+/*
+ * Select which cameras are in use:
+ * #define EAGLE_CAMERA0_RDACM20
+ * #define EAGLE_CAMERA0_RDACM21
+ *
+ * The two camera modules are configured with different image formats
+ * and cannot be mixed.
+ */
+#define EAGLE_CAMERA0_RDACM20
+#define EAGLE_CAMERA1_RDACM20
+#define EAGLE_CAMERA2_RDACM20
+#define EAGLE_CAMERA3_RDACM20
+
+/* Set the compatible string based on the camera model. */
+#if defined(EAGLE_CAMERA0_RDACM21) || defined(EAGLE_CAMERA1_RDACM21) || \
+ defined(EAGLE_CAMERA2_RDACM21) || defined(EAGLE_CAMERA3_RDACM21)
+#define EAGLE_CAMERA_MODEL "imi,rdacm21"
+#define EAGLE_USE_RDACM21
+#elif defined(EAGLE_CAMERA0_RDACM20) || defined(EAGLE_CAMERA1_RDACM20) || \
+ defined(EAGLE_CAMERA2_RDACM20) || defined(EAGLE_CAMERA3_RDACM20)
+#define EAGLE_CAMERA_MODEL "imi,rdacm20"
+#define EAGLE_USE_RDACM20
+#endif
+
+/* Define which cameras are available. */
+#if defined(EAGLE_CAMERA0_RDACM21) || defined(EAGLE_CAMERA0_RDACM20)
+#define EAGLE_USE_CAMERA_0
+#endif
+
+#if defined(EAGLE_CAMERA1_RDACM21) || defined(EAGLE_CAMERA1_RDACM20)
+#define EAGLE_USE_CAMERA_1
+#endif
+
+#if defined(EAGLE_CAMERA2_RDACM21) || defined(EAGLE_CAMERA2_RDACM20)
+#define EAGLE_USE_CAMERA_2
+#endif
+
+#if defined(EAGLE_CAMERA3_RDACM21) || defined(EAGLE_CAMERA3_RDACM20)
+#define EAGLE_USE_CAMERA_3
+#endif
+
+/* Define the endpoint links. */
+#ifdef EAGLE_USE_CAMERA_0
+&max9286_in0 {
+ remote-endpoint = <&fakra_con0>;
+};
+#endif
+
+#ifdef EAGLE_USE_CAMERA_1
+&max9286_in1 {
+ remote-endpoint = <&fakra_con1>;
+};
+#endif
+
+#ifdef EAGLE_USE_CAMERA_2
+&max9286_in2 {
+ remote-endpoint = <&fakra_con2>;
+};
+#endif
+
+#ifdef EAGLE_USE_CAMERA_3
+&max9286_in3 {
+ remote-endpoint = <&fakra_con3>;
+};
+#endif
+
+/* Populate the GMSL i2c-mux bus with camera nodes. */
+#if defined(EAGLE_USE_RDACM21) || defined(EAGLE_USE_RDACM20)
+
+#ifdef EAGLE_USE_CAMERA_0
+&vin0 {
+ status = "okay";
+};
+#endif
+
+#ifdef EAGLE_USE_CAMERA_1
+&vin1 {
+ status = "okay";
+};
+#endif
+
+#ifdef EAGLE_USE_CAMERA_2
+&vin2 {
+ status = "okay";
+};
+#endif
+
+#ifdef EAGLE_USE_CAMERA_3
+&vin3 {
+ status = "okay";
+};
+#endif
+
+&gmsl {
+
+ status = "okay";
+ maxim,reverse-channel-microvolt = <100000>;
+
+ i2c-mux {
+#ifdef EAGLE_USE_CAMERA_0
+ i2c@0 {
+ status = "okay";
+
+ camera@51 {
+ compatible = EAGLE_CAMERA_MODEL;
+ reg = <0x51>, <0x61>;
+
+ port {
+ fakra_con0: endpoint {
+ remote-endpoint = <&max9286_in0>;
+ };
+ };
+ };
+ };
+#endif
+
+#ifdef EAGLE_USE_CAMERA_1
+ i2c@1 {
+ status = "okay";
+
+ camera@52 {
+ compatible = EAGLE_CAMERA_MODEL;
+ reg = <0x52>, <0x62>;
+
+ port {
+ fakra_con1: endpoint {
+ remote-endpoint = <&max9286_in1>;
+ };
+ };
+ };
+ };
+#endif
+
+#ifdef EAGLE_USE_CAMERA_2
+ i2c@2 {
+ status = "okay";
+
+ camera@53 {
+ compatible = EAGLE_CAMERA_MODEL;
+ reg = <0x53>, <0x63>;
+
+ port {
+ fakra_con2: endpoint {
+ remote-endpoint = <&max9286_in2>;
+ };
+ };
+ };
+ };
+#endif
+
+#ifdef EAGLE_USE_CAMERA_3
+ i2c@3 {
+ status = "okay";
+
+ camera@54 {
+ compatible = EAGLE_CAMERA_MODEL;
+ reg = <0x54>, <0x64>;
+
+ port {
+ fakra_con3: endpoint {
+ remote-endpoint = <&max9286_in3>;
+ };
+ };
+ };
+ };
+#endif
+ };
+};
+#endif
--
2.30.0

2021-02-15 17:45:53

by Jacopo Mondi

[permalink] [raw]
Subject: [PATCH 4/4] arm64: dts: renesas: eagle: Include eagle-gmsl

From: Kieran Bingham <[email protected]>

Include the eagle-gmsl.dtsi to enable GMSL camera support on the
Eagle-V3M platform.

Signed-off-by: Kieran Bingham <[email protected]>
Signed-off-by: Jacopo Mondi <[email protected]>
---
arch/arm64/boot/dts/renesas/r8a77970-eagle.dts | 3 +++
1 file changed, 3 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts b/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
index eb8f2b3a3bbd..f0ea65e1896d 100644
--- a/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
+++ b/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
@@ -404,3 +404,6 @@ &scif0 {

status = "okay";
};
+
+/* FAKRA Overlay */
+#include "eagle-gmsl.dtsi"
--
2.30.0

2021-02-15 17:46:25

by Jacopo Mondi

[permalink] [raw]
Subject: [PATCH 2/4] arm64: dts: renesas: eagle: Enable MAX9286

From: Kieran Bingham <[email protected]>

Enable the MAX9286 GMSL deserializer on the Eagle-V3M board.

Connected cameras should be defined in a device-tree overlay or included
after these definitions.

Signed-off-by: Kieran Bingham <[email protected]>
Signed-off-by: Jacopo Mondi <[email protected]>
---
.../arm64/boot/dts/renesas/r8a77970-eagle.dts | 132 ++++++++++++++++++
1 file changed, 132 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts b/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
index 874a7fc2730b..eb8f2b3a3bbd 100644
--- a/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
+++ b/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
@@ -6,6 +6,8 @@
* Copyright (C) 2017 Cogent Embedded, Inc.
*/

+#include <dt-bindings/gpio/gpio.h>
+
/dts-v1/;
#include "r8a77970.dtsi"

@@ -188,6 +190,11 @@ i2c0_pins: i2c0 {
function = "i2c0";
};

+ i2c3_pins: i2c3 {
+ groups = "i2c3_a";
+ function = "i2c3";
+ };
+
qspi0_pins: qspi0 {
groups = "qspi0_ctrl", "qspi0_data4";
function = "qspi0";
@@ -266,6 +273,131 @@ &rwdt {
status = "okay";
};

+&csi40 {
+ status = "okay";
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+
+ csi40_in: endpoint {
+ clock-lanes = <0>;
+ data-lanes = <1 2 3 4>;
+ remote-endpoint = <&max9286_out0>;
+ };
+ };
+ };
+};
+
+&i2c3 {
+ pinctrl-0 = <&i2c3_pins>;
+ pinctrl-names = "default";
+
+ status = "okay";
+ clock-frequency = <400000>;
+
+ gmsl: gmsl-deserializer@48 {
+ gpio-controller;
+ #gpio-cells = <2>;
+
+ compatible = "maxim,max9286";
+ reg = <0x48>;
+
+ /* eagle-pca9654-max9286-pwdn */
+ enable-gpios = <&io_expander 0 GPIO_ACTIVE_HIGH>;
+
+ /*
+ * Workaround: Hog the CAMVDD line high as we can't establish a
+ * regulator-fixed on the gpio_chip exposed by &gmsl due to
+ * circular-dependency issues.
+ */
+ camvdd_en {
+ gpio-hog;
+ gpios = <0 0>;
+ output-low;
+ line-name = "CAMVDD_EN";
+ };
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+ max9286_in0: endpoint {
+ };
+ };
+
+ port@1 {
+ reg = <1>;
+ max9286_in1: endpoint {
+ };
+ };
+
+ port@2 {
+ reg = <2>;
+ max9286_in2: endpoint {
+ };
+ };
+
+ port@3 {
+ reg = <3>;
+ max9286_in3: endpoint {
+ };
+ };
+
+ port@4 {
+ reg = <4>;
+ max9286_out0: endpoint {
+ clock-lanes = <0>;
+ data-lanes = <1 2 3 4>;
+ remote-endpoint = <&csi40_in>;
+ };
+ };
+ };
+
+ i2c-mux {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ i2c@0 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <0>;
+
+ status = "disabled";
+ };
+
+ i2c@1 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <1>;
+
+ status = "disabled";
+ };
+
+ i2c@2 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <2>;
+
+ status = "disabled";
+ };
+
+ i2c@3 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <3>;
+
+ status = "disabled";
+ };
+ };
+ };
+};
+
&scif0 {
pinctrl-0 = <&scif0_pins>;
pinctrl-names = "default";
--
2.30.0

2021-03-05 21:54:56

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH 1/4] dt-bindings: media: max9286: Describe gpio-hog

On Mon, Feb 15, 2021 at 06:24:44PM +0100, Jacopo Mondi wrote:
> The MAX9286 GMSL deserializer features gpio controller capabilities,
> as it provides 2 GPIO lines.
>
> As establishing a regulator that uses one of the GPIO lines and
> enabling/disabling it at run-time in the max9286 won't work due to
> a circular dependency on the gpio-controller/regulator creation, allow
> the usage of a gpio-hog for that purpose.
>
> The usage of the gpio-hog is required in designs where the MAX9286
> GPIO lines control the remote cameras power.
>
> Signed-off-by: Jacopo Mondi <[email protected]>
> ---
> .../devicetree/bindings/media/i2c/maxim,max9286.yaml | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml b/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml
> index ee16102fdfe7..9d5ecfd2397c 100644
> --- a/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml
> +++ b/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml
> @@ -50,6 +50,15 @@ properties:
> '#gpio-cells':
> const: 2
>
> + camvdd_en:

I don't think we want to document all the GPIO hogs, but rather have a
pattern we can check. IOW, having node name pattern we match on. I think
the core schemas has this now.

> + type: object
> + properties:
> + gpio-hog: true
> + gpios: true
> + output-low: true
> + line-name:
> + const: "CAMVDD_EN"
> +
> maxim,reverse-channel-microvolt:
> minimum: 30000
> maximum: 200000
> --
> 2.30.0
>