Last edited one month ago

CSI device tree configuration

Applicable for STM32MP25x lines

1. Article purpose[edit source]

The purpose of this article is to explain how to configure the CSI internal peripheral by using the device tree mechanism. The explanation relies on the binding documentation that corresponds to the description of the required and optional device-tree properties.

The peripheral can be assigned to different context or software components, depending on the final product needs. Refer to How to assign an internal peripheral to an execution context for more information about this configuration.

2. DT bindings documentation[edit source]

The device tree binding documents are stored, either in the given applicable components listed below, or in the Linux kernel repository:

  • Linux® OS :
    • For example: STM32 CSI device tree bindings:[1]
Warning white.png Warning
The STM32 CSI device tree binding file will be renamed st,stm32-csi.yaml in the final delivery.

3. DT configuration[edit source]

This hardware description is a combination of the STM32 microprocessor device tree files (.dtsi extension) and board device tree files (.dts extension). See the section Device tree for an explanation of the device-tree file organization.

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/SoC level)[edit source]

The CSI device tree node is located in stm32mp251.dtsi [2].

The declaration that is shown below provides the hardware register base address, interrupts, reset line and clocks used.

			csi2host: csi2host@48020000 {
				compatible = "st,stm32-csi2host";
				reg = <0x48020000 0x2000>;
				interrupts = <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>;
				resets = <&rcc CSI_R>;
				clocks = <&rcc CK_KER_CSI>, <&rcc CK_KER_CSITXESC>,
					 <&rcc CK_KER_CSIPHY>;
				clock-names = "pclk", "txesc", "csi2phy";
				feature-domains = <&rifsc STM32MP25_RIFSC_CSI_ID>;
				power-domains = <&CLUSTER_PD>;
				status = "disabled";
Warning white.png Warning
This device tree part is related to the STM32 microprocessors. It must be kept as is, without being modified by the end-user.
Warning white.png Warning
The compatible property will be renamed st,stm32-csi and node name renamed csi instead of csi2host in the final delivery.

When using a different image sensor device, only the sensor-related configuration part must be adapted in the associated board device tree file (see #DT configuration (board level)).

Refer to the STM32 CSI device tree binding file[1] for more details.

3.2. DT configuration (board level)[edit source]

The objective of this chapter is to explain how to enable and configure the CSI DT nodes for a board.

&csi2host {
	vdd-supply =  <&scmi_vddcore>;
	vdda18-supply = <&scmi_v1v8>;
	status = "okay";
	ports {
		#address-cells = <1>;
		#size-cells = <0>;
		port@0 {
			reg = <0>;
			csi2host_sink: endpoint {
				remote-endpoint = <&imx335_ep>;
				data-lanes = <0 1>;
				bus-type = <4>;
		port@1 {
			reg = <1>;
			csi2host_source: endpoint {
				remote-endpoint = <&dcmipp_0>;

&dcmipp {
	status = "okay";
	port {
		dcmipp_0: endpoint {
			remote-endpoint = <&csi2host_source>;
			bus-type = <4>;

&i2c2 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&i2c2_pins_a>;
	pinctrl-1 = <&i2c2_sleep_pins_a>;
	i2c-scl-rising-time-ns = <100>;
	i2c-scl-falling-time-ns = <13>;
	clock-frequency = <400000>;
	status = "okay";
	/* spare dmas for other usage */

	imx335: imx335@1a {
		compatible = "sony,imx335";
		reg = <0x1a>;
		clocks = <&clk_ext_camera>;
		reset-gpios = <&gpioi 7 (GPIO_ACTIVE_HIGH | GPIO_PUSH_PULL)>;
		powerdown-gpios = <&gpioi 0 (GPIO_ACTIVE_HIGH | GPIO_PUSH_PULL)>;
		status = "okay";

		port {
			imx335_ep: endpoint {
				remote-endpoint = <&csi2host_sink>;
				clock-lanes = <0>;
				data-lanes = <1 2>;
				link-frequencies = /bits/ 64 <594000000>;

This section, part of the STM32MP257x-EV1 Evaluation board More info green.png device tree file[3], shows how the CSI internal peripheral is configured to interconnect with a Sony IMX335 CSI sensor module and to the DCMIPP[4] internal peripheral. The csi2host node has two ports: one that must be connected to the video device (such as a sensor) from which the CSI receives data from, and one that must be connected to the input port of the DCMIPP node. The configurable settings are the following ones:

  • "remote-endpoint": in this case, the Sony IMX335 sensor model[5].
  • "data-lanes": Number and ordering of CSI-2, one or two entries. In case of two lanes <1 2>, it means that the lanes are not crossed, while <2 1> means that physical lane 2 becomes logical lane 1.
  • "bus-type": should not be changed, this corresponds to the CSI-2 DPHY bus type.

Refer to the STM32 CSI device tree binding file[1] for more details.

4. How to configure the DT using STM32CubeMX[edit source]

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 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 source]

Refer to the following links for additional information: