Skip to contentSkip to conversation

media: sun6i: Add support for the H3 CSI controller

PATCH New Maxime Ripard 3 participants 10 messages Mar 5, 2018 – Jun 26, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover media: sun6i: Add support for the H3 CSI controller

Hi,

The H3 and H5 have a CSI controller based on the one previously found in the A31, that is currently supported by the sun6i-csi driver.

Add the compatibles to the device tree bindings and to the driver to make it work properly.

This obviously depends on the serie "Initial Allwinner V3s CSI Support" by Yong Deng.

Let me know what you think,
Maxime

Maxime Ripard (2):
dt-bindings: media: sun6i: Add A31 and H3 compatibles
media: sun6i: Add A31 compatible

Myl?ne Josserand (2):
ARM: dts: sun8i: Add the H3/H5 CSI controller
[DO NOT MERGE] ARM: dts: sun8i: Add CAM500B camera module to the Nano

    Pi M1+
 .../devicetree/bindings/media/sun6i-csi.txt        |  5 +-
 arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts      | 85 ++++++++++++++++++++++
 arch/arm/boot/dts/sunxi-h3-h5.dtsi                 | 22 ++++++
 drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c |  1 +
 4 files changed, 112 insertions(+), 1 deletion(-)
Signature · 1 line
2.14.3
#1 lore raw

PATCH 1/4 dt-bindings: media: sun6i: Add A31 and H3 compatibles

The H3 has a slightly different CSI controller (no BT656, no CCI) which looks a lot like the original A31 controller. Add a compatible for the A31, and more specific compatible the for the H3 to be used in combination for the A31.

---
 Documentation/devicetree/bindings/media/sun6i-csi.txt | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/media/sun6i-csi.txt +4 -1
index 2ff47a9507a6..18a5b3068b25 100644
@@ -5,7 +5,10 @@ Allwinner V3s SoC features two CSI module. CSI0 is used for MIPI CSI-2
 interface and CSI1 is used for parallel interface.
 
 Required properties:
-  - compatible: value must be "allwinner,sun8i-v3s-csi"
+  - compatible: value must be one of:
+    * "allwinner,sun6i-a31-csi", along with, optionally:
+      + "allwinner,sun8i-h3-csi"
+    * "allwinner,sun8i-v3s-csi"
   - reg: base address and size of the memory-mapped region.
   - interrupts: interrupt associated to this IP
   - clocks: phandles to the clocks feeding the CSI
Signature · 1 line
2.14.3
maintainer
#2 lore raw

PATCH 1/4 dt-bindings: media: sun6i: Add A31 and H3 compatibles

Quoted 9 lines · Maxime Ripard

The H3 has a slightly different CSI controller (no BT656, no CCI) which looks a lot like the original A31 controller. Add a compatible for the A31, and more specific compatible the for the H3 to be used in combination for the A31.

---
 Documentation/devicetree/bindings/media/sun6i-csi.txt | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
#3 lore raw

PATCH 2/4 media: sun6i: Add A31 compatible

In reply to Maxime Ripard

The first device that used that IP was the A31. Add it to our list of compatibles.

---
 drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c | 1 +
 1 file changed, 1 insertion(+)
drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c +1 -0
index 26d57e6053df..b05265f8edb5 100644
@@ -916,6 +916,7 @@ static int sun6i_csi_remove(struct platform_device *pdev)
 }
 
 static const struct of_device_id sun6i_csi_of_match[] = {
+	{ .compatible = "allwinner,sun6i-a31-csi", },
 	{ .compatible = "allwinner,sun8i-v3s-csi", },
 	{},
 };
Signature · 1 line
2.14.3
#4 lore raw

PATCH 3/4 ARM: dts: sun8i: Add the H3/H5 CSI controller

In reply to Maxime Ripard

From: Myl?ne Josserand <[email protected]>

The H3 and H5 features the same CSI controller that was initially found on the A31.

Add a DT node for it.

---
 arch/arm/boot/dts/sunxi-h3-h5.dtsi | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
arch/arm/boot/dts/sunxi-h3-h5.dtsi +22 -0
index 7a83b15225c7..fc538fd8282a 100644
@@ -325,6 +325,13 @@
 			interrupt-controller;
 			#interrupt-cells = <3>;
 
+			csi_pins: csi {
+				pins = "PE0", "PE1", "PE2", "PE3", "PE4",
+				       "PE5", "PE6", "PE7", "PE8", "PE9",
+				       "PE10", "PE11";
+				function = "csi";
+			};
+
 			emac_rgmii_pins: emac0 {
 				pins = "PD0", "PD1", "PD2", "PD3", "PD4",
 				       "PD5", "PD7", "PD8", "PD9", "PD10",
@@ -684,6 +691,21 @@
 			interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
 		};
 
+		csi: camera at 1cb0000 {
+			compatible = "allwinner,sun8i-h3-csi",
+				     "allwinner,sun6i-a31-csi";
+			reg = <0x01cb0000 0x1000>;
+			interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_CSI>,
+				 <&ccu CLK_CSI_SCLK>,
+				 <&ccu CLK_DRAM_CSI>;
+			clock-names = "bus", "mod", "ram";
+			resets = <&ccu RST_BUS_CSI>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&csi_pins>;
+			status = "disabled";
+		};
+
 		rtc: rtc at 1f00000 {
 			compatible = "allwinner,sun6i-a31-rtc";
 			reg = <0x01f00000 0x54>;
Signature · 1 line
2.14.3
#5 lore raw

PATCH 4/4 ARM: dts: sun8i: Add CAM500B camera module to the Nano Pi M1+

In reply to Maxime Ripard

From: Myl?ne Josserand <[email protected]>

The Nano Pi M1+ comes with an optional sensor based on the ov5640 from Omnivision. Enable the support for it in the DT.

---
 arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts | 85 +++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)
arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts +85 -0
index d7b6e1ac541a..a2d1c6bb8406 100644
@@ -52,6 +52,37 @@
 		ethernet1 = &sdio_wifi;
 	};
 
+	cam_xclk: cam-xclk {
+                #clock-cells = <0>;
+                compatible = "fixed-clock";
+                clock-frequency = <24000000>;
+                clock-output-names = "cam-xclk";
+        };
+
+        reg_cam_avdd: cam-avdd {
+                compatible = "regulator-fixed";
+                regulator-name = "cam500b-avdd";
+                regulator-min-microvolt = <2800000>;
+                regulator-max-microvolt = <2800000>;
+                vin-supply = <&reg_vcc3v3>;
+        };
+
+        reg_cam_dovdd: cam-dovdd {
+                compatible = "regulator-fixed";
+                regulator-name = "cam500b-dovdd";
+                regulator-min-microvolt = <1800000>;
+                regulator-max-microvolt = <1800000>;
+                vin-supply = <&reg_vcc3v3>;
+        };
+
+        reg_cam_dvdd: cam-dvdd {
+                compatible = "regulator-fixed";
+                regulator-name = "cam500b-dvdd";
+                regulator-min-microvolt = <1500000>;
+                regulator-max-microvolt = <1500000>;
+                vin-supply = <&reg_vcc3v3>;
+        };
+
 	reg_gmac_3v3: gmac-3v3 {
 		compatible = "regulator-fixed";
 		regulator-name = "gmac-3v3";
@@ -69,6 +100,26 @@
 	};
 };
 
+&csi {
+        status = "okay";
+
+        port {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                /* Parallel bus endpoint */
+                csi_from_ov5640: endpoint {
+                        remote-endpoint = <&ov5640_to_csi>;
+                        bus-width = <8>;
+                        data-shift = <2>;
+                        hsync-active = <1>; /* Active high */
+                        vsync-active = <0>; /* Active low */
+                        data-active = <1>;  /* Active high */
+                        pclk-sample = <1>;  /* Rising */
+                };
+        };
+};
+
 &ehci1 {
 	status = "okay";
 };
@@ -94,6 +145,40 @@
 	};
 };
 
+&i2c2 {
+	status = "okay";
+
+	ov5640: camera at 3c {
+                compatible = "ovti,ov5640";
+                reg = <0x3c>;
+                clocks = <&cam_xclk>;
+                clock-names = "xclk";
+
+                reset-gpios = <&pio 4 14 GPIO_ACTIVE_LOW>;
+                powerdown-gpios = <&pio 4 15 GPIO_ACTIVE_HIGH>;
+                AVDD-supply = <&reg_cam_avdd>;
+                DOVDD-supply = <&reg_cam_dovdd>;
+                DVDD-supply = <&reg_cam_dvdd>;
+
+                port {
+                        ov5640_to_csi: endpoint {
+                                remote-endpoint = <&csi_from_ov5640>;
+                                bus-width = <8>;
+                                data-shift = <2>;
+                                hsync-active = <1>; /* Active high */
+                                vsync-active = <0>; /* Active low */
+                                data-active = <1>;  /* Active high */
+                                pclk-sample = <1>;  /* Rising */
+                        };
+                };
+        };
+
+};
+
+&i2c2_pins {
+	bias-pull-up;
+};
+
 &ir {
 	pinctrl-names = "default";
 	pinctrl-0 = <&ir_pins_a>;
Signature · 1 line
2.14.3
#6 lore raw

cover media: sun6i: Add support for the H3 CSI controller

In reply to Maxime Ripard
Quoted 14 lines · Maxime Ripard

Hi,

The H3 and H5 have a CSI controller based on the one previously found in the A31, that is currently supported by the sun6i-csi driver.

Add the compatibles to the device tree bindings and to the driver to make it work properly.

This obviously depends on the serie "Initial Allwinner V3s CSI Support" by Yong Deng.

Let me know what you think,
Maxime

Quoted 8 lines

Maxime Ripard (2):
dt-bindings: media: sun6i: Add A31 and H3 compatibles
media: sun6i: Add A31 compatible

Myl?ne Josserand (2):
ARM: dts: sun8i: Add the H3/H5 CSI controller
[DO NOT MERGE] ARM: dts: sun8i: Add CAM500B camera module to the Nano

    Pi M1+

Just trying to understand what interface has been tested with npi-m1+, is it DVP (parallel) interface? I've Bananapi 5MP[1] and trying to test on top, and look like its MIPI CSI2. I guess Yong patch[2] doesn't support CSI2 yet, am I correct?

[1] https://www.amazon.in/Generic-V3-0-BPI-M3-camera-chipset/dp/B0727N5CD1
[2] https://patchwork.kernel.org/patch/10380067/

Jagan.

Signature · 4 lines
Jagan Teki
Senior Linux Kernel Engineer | Amarula Solutions
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
#7 lore raw

cover media: sun6i: Add support for the H3 CSI controller

Hi,

Quoted 17 lines · Jagan Teki
Quoted 16 lines · Maxime Ripard

The H3 and H5 have a CSI controller based on the one previously found in the A31, that is currently supported by the sun6i-csi driver.

Add the compatibles to the device tree bindings and to the driver to make it work properly.

This obviously depends on the serie "Initial Allwinner V3s CSI Support" by Yong Deng.

Let me know what you think,
Maxime

Maxime Ripard (2):
dt-bindings: media: sun6i: Add A31 and H3 compatibles
media: sun6i: Add A31 compatible

Quoted 7 lines
Quoted 4 lines

Myl?ne Josserand (2):
ARM: dts: sun8i: Add the H3/H5 CSI controller
[DO NOT MERGE] ARM: dts: sun8i: Add CAM500B camera module to the Nano

    Pi M1+

Just trying to understand what interface has been tested with npi-m1+, is it DVP (parallel) interface?

Yes

Quoted 3 lines

I've Bananapi 5MP[1] and trying to test on top, and look like its MIPI CSI2. I guess Yong patch[2] doesn't support CSI2 yet, am I correct?

This is what Yong's cover letter is saying yes :)

The name Allwinner chose for this IP is very unfortunate...

Maxime

Signature · 3 lines
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#8 lore raw

cover media: sun6i: Add support for the H3 CSI controller

Quoted 28 lines · Maxime Ripard

Hi,

Quoted 17 lines · Jagan Teki
Quoted 16 lines · Maxime Ripard

The H3 and H5 have a CSI controller based on the one previously found in the A31, that is currently supported by the sun6i-csi driver.

Add the compatibles to the device tree bindings and to the driver to make it work properly.

This obviously depends on the serie "Initial Allwinner V3s CSI Support" by Yong Deng.

Let me know what you think,
Maxime

Maxime Ripard (2):
dt-bindings: media: sun6i: Add A31 and H3 compatibles
media: sun6i: Add A31 compatible

Quoted 7 lines
Quoted 4 lines

Myl?ne Josserand (2):
ARM: dts: sun8i: Add the H3/H5 CSI controller
[DO NOT MERGE] ARM: dts: sun8i: Add CAM500B camera module to the Nano

    Pi M1+

Just trying to understand what interface has been tested with npi-m1+, is it DVP (parallel) interface?

Quoted 7 lines

Yes

Quoted 3 lines

I've Bananapi 5MP[1] and trying to test on top, and look like its MIPI CSI2. I guess Yong patch[2] doesn't support CSI2 yet, am I correct?

This is what Yong's cover letter is saying yes :)

Thanks, and this ov5640 tested on -next or any specific code? please provide if you have different code base.

Jagan.

#9 lore raw

cover media: sun6i: Add support for the H3 CSI controller

Quoted 32 lines · Jagan Teki
Quoted 30 lines · Maxime Ripard

Hi,

Quoted 17 lines · Jagan Teki
Quoted 16 lines · Maxime Ripard

The H3 and H5 have a CSI controller based on the one previously found in the A31, that is currently supported by the sun6i-csi driver.

Add the compatibles to the device tree bindings and to the driver to make it work properly.

This obviously depends on the serie "Initial Allwinner V3s CSI Support" by Yong Deng.

Let me know what you think,
Maxime

Maxime Ripard (2):
dt-bindings: media: sun6i: Add A31 and H3 compatibles
media: sun6i: Add A31 compatible

Quoted 7 lines
Quoted 4 lines

Myl?ne Josserand (2):
ARM: dts: sun8i: Add the H3/H5 CSI controller
[DO NOT MERGE] ARM: dts: sun8i: Add CAM500B camera module to the Nano

    Pi M1+

Just trying to understand what interface has been tested with npi-m1+, is it DVP (parallel) interface?

Yes

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

I've Bananapi 5MP[1] and trying to test on top, and look like its MIPI CSI2. I guess Yong patch[2] doesn't support CSI2 yet, am I correct?

This is what Yong's cover letter is saying yes :)

Thanks, and this ov5640 tested on -next or any specific code? please provide if you have different code base.

It should work with the current ov5640 driver.

Maxime

Signature · 3 lines
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com