Skip to contentSkip to conversation

Enable stm32mp1 camera support

PATCH In review Hugues Fruchet 2 participants 6 messages Feb 28, 2019 – May 21, 2019

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

cover Enable stm32mp1 camera support

This patchset serie enables camera of stm32mp157c evaluation board. To do so, both stm32mp157c DCMI camera interface driver and OV5640 camera module driver are enabled in devicetree.

DCMI camera interface driver is enabled by default in multi_v7 configuration but OV5640 driver remains to be selected at kernel configuration time.

This patchset depends on STMicroelectronics Multi-Function eXpander (STMFX) support [1].

[1] https://www.mail-archive.com/[email protected]/msg1944108.html

Hugues Fruchet (4):
ARM: dts: stm32: add 2v8 fixed regulator for stm32mp157c-ed1 board
ARM: dts: stm32: add DCMI camera interface support on stm32mp157c
ARM: dts: stm32: add DCMI pins to stm32mp157c
ARM: dts: stm32: enable OV5640 camera on stm32mp157c-ev1 board

 arch/arm/boot/dts/stm32mp157-pinctrl.dtsi | 41 ++++++++++++++++++++++
 arch/arm/boot/dts/stm32mp157c-ed1.dts     |  8 +++++
 arch/arm/boot/dts/stm32mp157c-ev1.dts     | 56 +++++++++++++++++++++++++++++++
 arch/arm/boot/dts/stm32mp157c.dtsi        | 12 +++++++
 4 files changed, 117 insertions(+)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/4 ARM: dts: stm32: add 2v8 fixed regulator for stm32mp157c-ed1 board

Add 2v8 fixed regulator and enable it.

---
 arch/arm/boot/dts/stm32mp157c-ed1.dts | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/boot/dts/stm32mp157c-ed1.dts +8 -0
index 10dc7c0..4b5bcfd 100644
@@ -57,6 +57,14 @@
 		regulator-boot-on;
 	};
 
+	v2v8: ldo2 {
+		compatible = "regulator-fixed";
+		regulator-name = "v2v8";
+		regulator-min-microvolt = <2800000>;
+		regulator-max-microvolt = <2800000>;
+		regulator-always-on;
+	};
+
 	sd_switch: regulator-sd_switch {
 		compatible = "regulator-gpio";
 		regulator-name = "sd_switch";
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/4 ARM: dts: stm32: add DCMI camera interface support on stm32mp157c

In reply to Hugues Fruchet

Add DCMI camera interface support on stm32mp157c.

---
 arch/arm/boot/dts/stm32mp157c.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm/boot/dts/stm32mp157c.dtsi +12 -0
index 10bf338..1ff331c 100644
@@ -886,6 +886,18 @@
 			status = "disabled";
 		};
 
+		dcmi: dcmi@4c006000 {
+			compatible = "st,stm32-dcmi";
+			reg = <0x4c006000 0x400>;
+			interrupts = <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>;
+			resets = <&rcc CAMITF_R>;
+			clocks = <&rcc DCMI>;
+			clock-names = "mclk";
+			dmas = <&dmamux1 75 0x400 0x0d>;
+			dma-names = "tx";
+			status = "disabled";
+		};
+
 		rcc: rcc@50000000 {
 			compatible = "st,stm32mp1-rcc", "syscon";
 			reg = <0x50000000 0x1000>;
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/4 ARM: dts: stm32: add DCMI pins to stm32mp157c

In reply to Hugues Fruchet

Add DCMI pins to stm32mp157c.

---
 arch/arm/boot/dts/stm32mp157-pinctrl.dtsi | 41 +++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
arch/arm/boot/dts/stm32mp157-pinctrl.dtsi +41 -0
index 6b3a9c6..b299afc 100644
@@ -414,6 +414,47 @@
 					bias-disable;
 				};
 			};
+
+			dcmi_pins_a: dcmi-0 {
+				pins {
+					pinmux = <STM32_PINMUX('H', 8,  AF13)>,/* DCMI_HSYNC */
+						 <STM32_PINMUX('B', 7,  AF13)>,/* DCMI_VSYNC */
+						 <STM32_PINMUX('A', 6,  AF13)>,/* DCMI_PIXCLK */
+						 <STM32_PINMUX('H', 9,  AF13)>,/* DCMI_D0 */
+						 <STM32_PINMUX('H', 10, AF13)>,/* DCMI_D1 */
+						 <STM32_PINMUX('H', 11, AF13)>,/* DCMI_D2 */
+						 <STM32_PINMUX('H', 12, AF13)>,/* DCMI_D3 */
+						 <STM32_PINMUX('H', 14, AF13)>,/* DCMI_D4 */
+						 <STM32_PINMUX('I', 4,  AF13)>,/* DCMI_D5 */
+						 <STM32_PINMUX('B', 8,  AF13)>,/* DCMI_D6 */
+						 <STM32_PINMUX('E', 6,  AF13)>,/* DCMI_D7 */
+						 <STM32_PINMUX('I', 1,  AF13)>,/* DCMI_D8 */
+						 <STM32_PINMUX('H', 7,  AF13)>,/* DCMI_D9 */
+						 <STM32_PINMUX('I', 3,  AF13)>,/* DCMI_D10 */
+						 <STM32_PINMUX('H', 15, AF13)>;/* DCMI_D11 */
+					bias-disable;
+				};
+			};
+
+			dcmi_sleep_pins_a: dcmi-sleep-0 {
+				pins {
+					pinmux = <STM32_PINMUX('H', 8,  ANALOG)>,/* DCMI_HSYNC */
+						 <STM32_PINMUX('B', 7,  ANALOG)>,/* DCMI_VSYNC */
+						 <STM32_PINMUX('A', 6,  ANALOG)>,/* DCMI_PIXCLK */
+						 <STM32_PINMUX('H', 9,  ANALOG)>,/* DCMI_D0 */
+						 <STM32_PINMUX('H', 10, ANALOG)>,/* DCMI_D1 */
+						 <STM32_PINMUX('H', 11, ANALOG)>,/* DCMI_D2 */
+						 <STM32_PINMUX('H', 12, ANALOG)>,/* DCMI_D3 */
+						 <STM32_PINMUX('H', 14, ANALOG)>,/* DCMI_D4 */
+						 <STM32_PINMUX('I', 4,  ANALOG)>,/* DCMI_D5 */
+						 <STM32_PINMUX('B', 8,  ANALOG)>,/* DCMI_D6 */
+						 <STM32_PINMUX('E', 6,  ANALOG)>,/* DCMI_D7 */
+						 <STM32_PINMUX('I', 1,  ANALOG)>,/* DCMI_D8 */
+						 <STM32_PINMUX('H', 7,  ANALOG)>,/* DCMI_D9 */
+						 <STM32_PINMUX('I', 3,  ANALOG)>,/* DCMI_D10 */
+						 <STM32_PINMUX('H', 15, ANALOG)>;/* DCMI_D11 */
+				};
+			};
 		};
 
 		pinctrl_z: pin-controller-z@54004000 {
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/4 ARM: dts: stm32: enable OV5640 camera on stm32mp157c-ev1 board

In reply to Hugues Fruchet

Enable OV5640 camera sensor driver of MB1379A extension board connected on CN7 connector of stm32mp157c-ev1 board:
bus-width is set to 8, data-shift is set to 2 (lines 9:2 are used), hsync-active is set to 0 for horizontal synchro line active low, vsync-active is set to 0 for vertical synchro line active low and pclk-sample is set to 1 for pixel clock polarity sampling data on rising edge of the pixel clock signal.

---
 arch/arm/boot/dts/stm32mp157c-ev1.dts | 56 +++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)
arch/arm/boot/dts/stm32mp157c-ev1.dts +56 -0
index 009f9d6..8fb1688 100644
@@ -65,6 +65,14 @@
 		default-on;
 		status = "okay";
 	};
+
+	clocks {
+		clk_ext_camera: clk-ext-camera {
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <24000000>;
+		};
+	};
 };
 
 &cec {
@@ -73,6 +81,23 @@
 	status = "okay";
 };
 
+&dcmi {
+	status = "okay";
+	pinctrl-names = "default", "sleep";
+	pinctrl-0 = <&dcmi_pins_a>;
+	pinctrl-1 = <&dcmi_sleep_pins_a>;
+
+	port {
+		dcmi_0: endpoint {
+			remote-endpoint = <&ov5640_0>;
+			bus-width = <8>;
+			hsync-active = <0>;
+			vsync-active = <0>;
+			pclk-sample = <1>;
+		};
+	};
+};
+
 &dsi {
 	#address-cells = <1>;
 	#size-cells = <0>;
@@ -138,6 +163,31 @@
 	i2c-scl-falling-time-ns = <20>;
 	status = "okay";
 
+	ov5640: camera@3c {
+		compatible = "ovti,ov5640";
+		pinctrl-names = "default";
+		pinctrl-0 = <&ov5640_pins>;
+		reg = <0x3c>;
+		clocks = <&clk_ext_camera>;
+		clock-names = "xclk";
+		DOVDD-supply = <&v2v8>;
+		powerdown-gpios = <&stmfx_pinctrl 18 GPIO_ACTIVE_HIGH>;
+		reset-gpios = <&stmfx_pinctrl 19 GPIO_ACTIVE_LOW>;
+		rotation = <180>;
+		status = "okay";
+
+		port {
+			ov5640_0: endpoint {
+				remote-endpoint = <&dcmi_0>;
+				bus-width = <8>;
+				data-shift = <2>; /* lines 9:2 are used */
+				hsync-active = <0>;
+				vsync-active = <0>;
+				pclk-sample = <1>;
+			};
+		};
+	};
+
 	stmfx: stmfx@42 {
 		compatible = "st,stmfx-0300";
 		reg = <0x42>;
@@ -157,6 +207,12 @@
 				drive-push-pull;
 				bias-pull-down;
 			};
+
+			ov5640_pins: camera {
+				pins = "agpio2", "agpio3"; /* stmfx pins 18 & 19 */
+				drive-push-pull;
+				output-low;
+			};
 		};
 	};
 };
Signature · 1 line
2.7.4
#5 lore raw
In reply to Hugues Fruchet

Dear Hugues,

Quoted 18 lines · Hugues Fruchet

This patchset serie enables camera of stm32mp157c evaluation board. To do so, both stm32mp157c DCMI camera interface driver and OV5640 camera module driver are enabled in devicetree.

DCMI camera interface driver is enabled by default in multi_v7 configuration but OV5640 driver remains to be selected at kernel configuration time.

This patchset depends on STMicroelectronics Multi-Function eXpander (STMFX) support [1].

[1] https://www.mail-archive.com/[email protected]/msg1944108.html

Hugues Fruchet (4):
ARM: dts: stm32: add 2v8 fixed regulator for stm32mp157c-ed1 board
ARM: dts: stm32: add DCMI camera interface support on stm32mp157c
ARM: dts: stm32: add DCMI pins to stm32mp157c
ARM: dts: stm32: enable OV5640 camera on stm32mp157c-ev1 board

Quoted 6 lines
  arch/arm/boot/dts/stm32mp157-pinctrl.dtsi | 41 ++++++++++++++++++++++
  arch/arm/boot/dts/stm32mp157c-ed1.dts     |  8 +++++
  arch/arm/boot/dts/stm32mp157c-ev1.dts     | 56 +++++++++++++++++++++++++++++++
  arch/arm/boot/dts/stm32mp157c.dtsi        | 12 +++++++
  4 files changed, 117 insertions(+)

Patch 2 to 4 applied on stm32-next. Patch 1 is no longer needed as regulators are now provided by PMIC.

thanks
Alex