Difference between revisions of "DCMIPP device tree configuration"
[quality revision] | [quality revision] |
m
|
m
|
Applicable for | STM32MP13x lines |
Contents
1 Article purpose[edit]
This article explains how to configure the DCMIPP internal peripheral when assigned to the Linux® OS. In that case, it is controlled by the V4L2 camera framework.
The configuration is performed using the device tree mechanism that provides a hardware description of the DCMIPP peripheral, used by the STM32 DCMIPP Linux driver or by the V4L2 camera framework.
If the peripheral is assigned to another execution context, refer to How to assign an internal peripheral to a runtime context article for guidelines on peripheral assignment and configuration.
2 DT bindings documentation[edit]
The DCMIPP internal peripheral is documented through the STM32 DCMIPP device tree bindings file[1].
3 DT configuration[edit]
This hardware description is a combination of the STM32 microprocessor device tree files (.dtsi extension) and board device tree files (.dts extension). See the device tree article for an explanation of the device tree file split.
STM32CubeMX can be used to generate the board device tree. Refer to How to configure the DT using STM32CubeMX for more details.
3.1 DT configuration (STM32 level)[edit]
The DCMIPP device tree node is declared in stm32mp135.dtsi [2].
The declaration (shown below) provides the hardware registers base address, interrupts, reset line and clocks used.
dcmipp: dcmipp@5a000000 { compatible = "st,stm32mp13-dcmipp"; reg = <0x5a000000 0x400>; interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>; resets = <&rcc DCMIPP_R>; clocks = <&rcc DCMIPP_K>; clock-names = "kclk"; status = "disabled"; };
![]() |
This device tree part is related to STM32 microprocessors. It must be kept as is, without being modified by the end-user. |
When using a different sensor camera device, only the sensor-related configuration part must be adapted in the associated board device tree file (see #DT configuration (board level)).
Refer to stm32-dcmipp bindings[1] for more details.
3.2 DT configuration (board level)[edit]
&dcmipp { status = "okay"; pinctrl-names = "default", "sleep"; pinctrl-0 = <&dcmipp_pins_a>; pinctrl-1 = <&dcmipp_sleep_pins_a>; port { dcmipp_0: endpoint { remote-endpoint = <&mipid02_2>; bus-width = <8>; hsync-active = <0>; vsync-active = <0>; pclk-sample = <0>; }; }; [...] stmipi: stmipi@14 { compatible = "st,st-mipid02"; reg = <0x14>; status = "okay"; clocks = <&clk_mco1>; clock-names = "xclk"; VDDE-supply = <&scmi_v1v8_periph>; VDDIN-supply = <&scmi_v1v8_periph>; reset-gpios = <&mcp23017 2 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>; ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; mipid02_0: endpoint { data-lanes = <1 2>; lane-polarities = <0 0 0>; remote-endpoint = <&ov5640_0>; }; }; port@2 { reg = <2>; mipid02_2: endpoint { bus-width = <8>; hsync-active = <0>; vsync-active = <0>; pclk-sample = <0>; remote-endpoint = <&dcmipp_0>; }; }; }; }; };
This section, part of the STM32MP135x-DK Discovery kit device tree file[3], shows how is configured the DCMIPP hardware block to interconnect with a serial CSI-2 camera sensor through the ST-Microelectronics MIPID02 CSI-2 to parallel bridge. The configurable settings are the following:
- Camera sensor endpoint: in this case, the Omnivision OV5640 model[4].
- Number of CSI-2 data lanes: 1 or 2
- Lanes polarity: active low (0) or active high (1)
This section also defines what is the DCMIPP pins multiplexing used for this board (<&dcmipp_pins_a>, <&dcmipp_sleep_pins_a>), exact pins details being defined in the STM32MP135x-DK Discovery kit pinctrl device tree file[5]:
dcmipp_pins_a: dcmi-0 { pins1 { pinmux = <STM32_PINMUX('H', 8, AF13)>,/* DCMI_HSYNC */ <STM32_PINMUX('G', 9, AF13)>,/* DCMI_VSYNC */ <STM32_PINMUX('B', 7, AF14)>,/* DCMI_PIXCLK */ <STM32_PINMUX('A', 9, AF13)>,/* DCMI_D0 */ <STM32_PINMUX('D', 0, AF13)>,/* DCMI_D1 */ <STM32_PINMUX('G', 10, AF13)>,/* DCMI_D2 */ <STM32_PINMUX('E', 4, AF13)>,/* DCMI_D3 */ <STM32_PINMUX('D', 11, AF14)>,/* DCMI_D4 */ <STM32_PINMUX('D', 3, AF13)>,/* DCMI_D5 */ <STM32_PINMUX('B', 8, AF13)>,/* DCMI_D6 */ <STM32_PINMUX('E', 14, AF13)>;/* DCMI_D7 */ bias-disable; }; }; dcmipp_sleep_pins_a: dcmi-sleep-0 { pins1 { pinmux = <STM32_PINMUX('H', 8, ANALOG)>,/* DCMI_HSYNC */ <STM32_PINMUX('G', 9, ANALOG)>,/* DCMI_VSYNC */ <STM32_PINMUX('B', 7, ANALOG)>,/* DCMI_PIXCLK */ <STM32_PINMUX('A', 9, ANALOG)>,/* DCMI_D0 */ <STM32_PINMUX('D', 0, ANALOG)>,/* DCMI_D1 */ <STM32_PINMUX('G', 10, ANALOG)>,/* DCMI_D2 */ <STM32_PINMUX('E', 4, ANALOG)>,/* DCMI_D3 */ <STM32_PINMUX('D', 11, ANALOG)>,/* DCMI_D4 */ <STM32_PINMUX('D', 3, ANALOG)>,/* DCMI_D5 */ <STM32_PINMUX('B', 8, ANALOG)>,/* DCMI_D6 */ <STM32_PINMUX('E', 14, ANALOG)>;/* DCMI_D7 */ }; };
An alternate pin multiplexing could be defined (for example to fit a new board design) by modifying the STM32MP135x-DK Discovery kit pinctrl device tree file[5] following the possible pins assignment defined in the MPU datasheet[6].
STM32CubeMX [7] pins configurator is of great help to find valid alternatives thanks to its visual GUI.
Refer to STM32 DCMIPP bindings[1] for more details.
3.3 DT configuration examples[edit]
ov5640: camera@3c { compatible = "ovti,ov5640"; reg = <0x3c>; clocks = <&clk_ext_camera>; clock-names = "xclk"; DOVDD-supply = <&scmi_v3v3_sw>; status = "okay"; powerdown-gpios = <&mcp23017 3 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>; reset-gpios = <&mcp23017 4 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>; port { ov5640_0: endpoint { remote-endpoint = <&mipid02_0>; clock-lanes = <0>; data-lanes = <1 2>; }; }; };
This section, part of the STM32MP135x-DK Discovery kit device tree file[3], enables the support of the OV5640 Omnivision camera sensor[4] located on the MB1723 camera daughter board[8] connected to the CN1 camera connector[9] of the STM32MP135x-DK Discovery kit
. DCMIPP hardware block interconnects with the OV5640 camera sensor through the MIPID02 CSI-2 to parallel bridge of STM32MP135x-DK Discovery kit
.
Refer to the OV5640 bindings [4] and the MIPID02 bridge bindings [10] for more details.
Documentation on various V4L2 camera sensors can be found inside I2C media bindings folder[11]. Refer to the dedicated sensor binding documentation to adapt your board device tree file to this dedicated sensor.
4 How to configure the DT using STM32CubeMX[edit]
The STM32CubeMX tool can be used to configure the STM32MPU device and get the corresponding platform configuration device tree files.
The STM32CubeMX may not support all the properties described in the above DT bindings documentation paragraph. If so, the tool inserts user sections in the generated device tree. These sections can then be edited to add some properties and they are preserved from one generation to another. Refer to STM32CubeMX user manual for further information.
5 References[edit]
Please refer to the following links for additional information:
- ↑ 1.01.11.2 Linux kernel STM32 DCMIPP bindings (st,stm32-dcmipp.yaml)
- ↑ Linux kernel STM32MP135 device tree (stm32mp135.dtsi
-
↑ 3.03.1 Linux kernel STM32MP135x-DK Discovery kit
device tree (stm32mp135f-dk.dts)
- ↑ 4.04.14.2 Linux kernel OV5640 bindings (ov5640.txt)
- ↑ 5.05.1 Linux kernel STM32MP13 pinctrl device tree (stm32mp13-pinctrl.dtsi)
- ↑ STM32MP13 Datasheetdatasheets
- ↑ STM32CubeMX
- ↑ MB1723 camera daughter board
- ↑ CN1 Camera sensor connector
- ↑ Linux kernel MIPID02 bindings (st,st-mipid02.txt)
- ↑ Linux kernel I2C media devices bindings (bindings/media/i2c)
<noinclude>{{ApplicableFor |MPUs list=STM32MP13x |MPUs checklist=STM32MP13x,STM32MP15x }}</noinclude> == Article purpose == This article explains how to configure the [[DCMIPP internal peripheral | '''DCMIPP''' internal peripheral]] when assigned to the Linux<sup>®</sup> OS. In that case, it is controlled by the [[V4L2 camera overview|V4L2 camera framework]]. The configuration is performed using the [[Device tree|device tree]] mechanism that provides a hardware description of the DCMIPP peripheral, used by the STM32 DCMIPP Linux driver or by the V4L2 camera framework. If the peripheral is assigned to another execution context, refer to [[How to assign an internal peripheral to a runtime context]] article for guidelines on peripheral assignment and configuration. == DT bindings documentation == The DCMIPP internal peripheral is documented through the STM32 DCMIPP device tree bindings file<ref name=bindings>{{CodeSource | Linux kernel | Documentation/devicetree/bindings/media/st,stm32-dcmipp.yaml | Linux kernel STM32 DCMIPP bindings (st,stm32-dcmipp.yaml)}}</ref>. == DT configuration == This hardware description is a combination of the '''STM32 microprocessor''' device tree files (''.dtsi'' extension) and '''board''' device tree files (''.dts'' extension). See the [[Device tree|device tree]] article for an explanation of the device tree file split. '''STM32CubeMX''' can be used to generate the board device tree. Refer to [[#How_to_configure_the_DT_using_STM32CubeMX|How to configure the DT using STM32CubeMX]] for more details. ===DT configuration (STM32 level) === The DCMIPP device tree node is declared in stm32mp135.dtsi <ref name="stm32mp135_dtsi">{{CodeSource | Linux kernel | arch/arm/boot/dts/stm32mp135.dtsi | Linux kernel STM32MP135 device tree (stm32mp135.dtsi}}</ref>. The declaration (shown below) provides the hardware registers base address, interrupts, reset line and clocks used.<pre> dcmipp: dcmipp@5a000000 { compatible = "st,stm32mp13-dcmipp"; reg = <0x5a000000 0x400>; interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>; resets = <&rcc DCMIPP_R>; clocks = <&rcc DCMIPP_K>; clock-names = "kclk"; status = "disabled"; };</pre> {{Warning|This device tree part is related to STM32 microprocessors. It must be kept as is, without being modified by the end-user.}} When using a different sensor camera device, only the sensor-related configuration part must be adapted in the associated board device tree file (see [[#DT configuration (board level)]]). Refer to stm32-dcmipp bindings<ref name=bindings/> for more details. === DT configuration (board level) ===<pre> &dcmipp { status = "okay"; pinctrl-names = "default", "sleep"; pinctrl-0 = <&dcmipp_pins_a>; pinctrl-1 = <&dcmipp_sleep_pins_a>; port { dcmipp_0: endpoint { remote-endpoint = <&mipid02_2>; bus-width = <8>; hsync-active = <0>; vsync-active = <0>; pclk-sample = <0>; }; }; [...] stmipi: stmipi@14 { compatible = "st,st-mipid02"; reg = <0x14>; status = "okay"; clocks = <&clk_mco1>; clock-names = "xclk"; VDDE-supply = <&scmi_v1v8_periph>; VDDIN-supply = <&scmi_v1v8_periph>; reset-gpios = <&mcp23017 2 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>; ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; mipid02_0: endpoint { data-lanes = <1 2>; lane-polarities = <0 0 0>; remote-endpoint = <&ov5640_0>; }; }; port@2 { reg = <2>; mipid02_2: endpoint { bus-width = <8>; hsync-active = <0>; vsync-active = <0>; pclk-sample = <0>; remote-endpoint = <&dcmipp_0>; }; }; }; }; };</pre> This section, part of the {{Board | type=135x-DK}} device tree file<ref name="stm32mp135fdk_bindings">{{CodeSource | Linux kernel | arch/arm/boot/dts/stm32mp135f-dk.dts | Linux kernel {{Board | type=135x-DK}} device tree (stm32mp135f-dk.dts)}}</ref>, shows how is configured the DCMIPP hardware block to interconnect with a serial CSI-2 camera sensor through the ST-Microelectronics MIPID02 CSI-2 to parallel bridge. The configurable settings are the following: * Camera sensor endpoint: in this case, the Omnivision OV5640 model<ref name=ov5640_bindings>{{CodeSource | Linux kernel | Documentation/devicetree/bindings/media/i2c/ov5640.txt | Linux kernel OV5640 bindings (ov5640.txt)}}</ref>. * Number of CSI-2 data lanes: 1 or 2 * Lanes polarity: active low (0) or active high (1) This section also defines what is the DCMIPP pins multiplexing used for this board (''<&dcmipp_pins_a>, <&dcmipp_sleep_pins_a>''), exact pins details being defined in the {{Board | type=135x-DK}} pinctrl device tree file<ref name="stm32mp13_pinctrl_dtsi">{{CodeSource | Linux kernel | arch/arm/boot/dts/stm32mp13-pinctrl.dtsi | Linux kernel STM32MP13 pinctrl device tree (stm32mp13-pinctrl.dtsi)}}</ref>:<pre> dcmipp_pins_a: dcmi-0 { pins1 { pinmux = <STM32_PINMUX('H', 8, AF13)>,/* DCMI_HSYNC */<STM32_PINMUX('G', 9, AF13)>,/* DCMI_VSYNC */<STM32_PINMUX('B', 7, AF14)>,/* DCMI_PIXCLK */<STM32_PINMUX('A', 9, AF13)>,/* DCMI_D0 */<STM32_PINMUX('D', 0, AF13)>,/* DCMI_D1 */<STM32_PINMUX('G', 10, AF13)>,/* DCMI_D2 */<STM32_PINMUX('E', 4, AF13)>,/* DCMI_D3 */<STM32_PINMUX('D', 11, AF14)>,/* DCMI_D4 */<STM32_PINMUX('D', 3, AF13)>,/* DCMI_D5 */<STM32_PINMUX('B', 8, AF13)>,/* DCMI_D6 */<STM32_PINMUX('E', 14, AF13)>;/* DCMI_D7 */ bias-disable; }; }; dcmipp_sleep_pins_a: dcmi-sleep-0 { pins1 { pinmux = <STM32_PINMUX('H', 8, ANALOG)>,/* DCMI_HSYNC */<STM32_PINMUX('G', 9, ANALOG)>,/* DCMI_VSYNC */<STM32_PINMUX('B', 7, ANALOG)>,/* DCMI_PIXCLK */<STM32_PINMUX('A', 9, ANALOG)>,/* DCMI_D0 */<STM32_PINMUX('D', 0, ANALOG)>,/* DCMI_D1 */<STM32_PINMUX('G', 10, ANALOG)>,/* DCMI_D2 */<STM32_PINMUX('E', 4, ANALOG)>,/* DCMI_D3 */<STM32_PINMUX('D', 11, ANALOG)>,/* DCMI_D4 */<STM32_PINMUX('D', 3, ANALOG)>,/* DCMI_D5 */<STM32_PINMUX('B', 8, ANALOG)>,/* DCMI_D6 */<STM32_PINMUX('E', 14, ANALOG)>;/* DCMI_D7 */ }; };</pre> An alternate pin multiplexing could be defined (for example to fit a new board design) by modifying the {{Board | type=135x-DK}} pinctrl device tree file<ref name="stm32mp13_pinctrl_dtsi"/> following the possible pins assignment defined in the MPU datasheet<ref>[[STM32MP13 resources#DSxxxxxresources#Datasheets|STM32MP13 Datasheetdatasheets]]</ref>. STM32CubeMX <ref>[[STM32CubeMX]]</ref> pins configurator is of great help to find valid alternatives thanks to its visual GUI. Refer to STM32 DCMIPP bindings<ref name=bindings/> for more details. === DT configuration examples ===<pre> ov5640: camera@3c { compatible = "ovti,ov5640"; reg = <0x3c>; clocks = <&clk_ext_camera>; clock-names = "xclk"; DOVDD-supply = <&scmi_v3v3_sw>; status = "okay"; powerdown-gpios = <&mcp23017 3 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>; reset-gpios = <&mcp23017 4 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>; port { ov5640_0: endpoint { remote-endpoint = <&mipid02_0>; clock-lanes = <0>; data-lanes = <1 2>; }; }; };</pre> This section, part of the {{Board | type=135x-DK}} device tree file<ref name="stm32mp135fdk_bindings"/>, enables the support of the OV5640 Omnivision camera sensor<ref name=ov5640_bindings/> located on the MB1723 camera daughter board<ref>[[STM32MP135x-DK_-_hardware_description#MB1723 | MB1723 camera daughter board]]</ref> connected to the CN1 camera connector<ref>[[STM32MP135x-DK - hardware_description#MB1635-CN1|CN1 Camera sensor connector]]</ref> of the {{Board | type=135x-DK}}. DCMIPP hardware block interconnects with the OV5640 camera sensor through the MIPID02 CSI-2 to parallel bridge of {{Board | type=135x-DK}}. Refer to the OV5640 bindings <ref name=ov5640_bindings/> and the MIPID02 bridge bindings <ref name=mipid02_bindings>{{CodeSource | Linux kernel | Documentation/devicetree/bindings/media/i2c/st,st-mipid02.txt | Linux kernel MIPID02 bindings (st,st-mipid02.txt)}}</ref> for more details. Documentation on various V4L2 camera sensors can be found inside I2C media bindings folder<ref name=i2c_bindings>{{CodeSource | Linux kernel | Documentation/devicetree/bindings/media/i2c | Linux kernel I2C media devices bindings (bindings/media/i2c)}}</ref>. Refer to the dedicated sensor binding documentation to adapt your board device tree file to this dedicated sensor. ==How to configure the DT using STM32CubeMX== The [[STM32CubeMX]] tool can be used to configure the STM32MPU device and get the corresponding [[Device_tree#STM32_MPU|platform configuration device tree]] files.<br /> The STM32CubeMX may not support all the properties described in the above [[#DT bindings documentation|DT bindings documentation]] paragraph. If so, the tool inserts '''user sections''' in the generated device tree. These sections can then be edited to add some properties and they are preserved from one generation to another. Refer to [[STM32CubeMX]] user manual for further information. ==References== Please refer to the following links for additional information: <references /> <noinclude> {{ArticleBasedOnModel | Peripheral or framework device tree configuration model}} {{PublicationRequestId | 22728| 2022-03-03 | }} [[Category:Device tree configuration]] [[Category:V4L2]]</noinclude>
Line 135: | Line 135: | ||
}; |
}; |
||
</pre> |
</pre> |
||
− | An alternate pin multiplexing could be defined (for example to fit a new board design) by modifying the {{Board | type=135x-DK}} pinctrl device tree file<ref name="stm32mp13_pinctrl_dtsi"/> following the possible pins assignment defined in the MPU datasheet<ref>[[STM32MP13 resources# |
+ | An alternate pin multiplexing could be defined (for example to fit a new board design) by modifying the {{Board | type=135x-DK}} pinctrl device tree file<ref name="stm32mp13_pinctrl_dtsi"/> following the possible pins assignment defined in the MPU datasheet<ref>[[STM32MP13 resources#Datasheets|STM32MP13 datasheets]]</ref>. |
STM32CubeMX <ref>[[STM32CubeMX]]</ref> pins configurator is of great help to find valid alternatives thanks to its visual GUI. |
STM32CubeMX <ref>[[STM32CubeMX]]</ref> pins configurator is of great help to find valid alternatives thanks to its visual GUI. |
||
Line 170: | Line 170: | ||
==How to configure the DT using STM32CubeMX== |
==How to configure the DT using STM32CubeMX== |
||
− | The [[STM32CubeMX]] tool can be used to configure the STM32MPU device and get the corresponding [[Device_tree# |
+ | The [[STM32CubeMX]] tool can be used to configure the STM32MPU device and get the corresponding [[Device_tree#STM32_MPU|platform configuration device tree]] files.<br /> |
The STM32CubeMX may not support all the properties described in the above [[#DT bindings documentation|DT bindings documentation]] paragraph. If so, the tool inserts '''user sections''' in the generated device tree. These sections can then be edited to add some properties and they are preserved from one generation to another. Refer to [[STM32CubeMX]] user manual for further information. |
The STM32CubeMX may not support all the properties described in the above [[#DT bindings documentation|DT bindings documentation]] paragraph. If so, the tool inserts '''user sections''' in the generated device tree. These sections can then be edited to add some properties and they are preserved from one generation to another. Refer to [[STM32CubeMX]] user manual for further information. |
||