The MIPI camera sensor interfaces the MIPI CSI-2 RX subsystem with the CSI-2 RX PHY and host controller. This subsystem handles the sensor/image input and processing for all input imaging devices.

The MIPI CSI2 driver manages the MIPI RX PHY and the communication to the ISI (Image Sensing Interface).

On the ConnectCore 8X SBC Pro, the MIPI camera port is connected to MIPI-CSI0 I2C port.

Kernel configuration

You can manage the MIPI driver and the OmniVision OV5640 MIPI camera sensor driver through the kernel configuration options:

  • IMX8 MIPI CSI2 Controller (CONFIG_IMX8_MIPI_CSI2)

  • OmniVision OV5640 sensor support (CONFIG_VIDEO_OV5640)

These options are enabled as built-in on the default ConnectCore 8X kernel configuration file.

Kernel driver mapping

The driver for MIPI capture is available at the following location:

File Description

drivers/media/i2c/ov5640.c

OV5640 MIPI Camera Subdev Driver

drivers/staging/media/imx/imx8-mipi-csi2.c

MXC MIPI CSI2 driver

Device tree bindings and customization

The device tree must contain entries for:

  • The MIPI interface

  • The ISI interface

  • The I2C interface

  • The camera sensor

Definition of the MIPI CSI interface

i.MX8QXP device tree
mipi_csi_0: csi@58227000 {
	compatible = "fsl,mxc-mipi-csi2";
	reg = <0x58227000 0x1000>,
	      <0x58221000 0x1000>;
	clocks = <&csi0_core_lpcg 0>,
		 <&csi0_esc_lpcg 0>,
		 <&csi0_pxl_lpcg 0>;
	clock-names = "clk_core", "clk_esc", "clk_pxl";
	assigned-clocks = <&csi0_core_lpcg 0>,
			  <&csi0_esc_lpcg 0>;
	assigned-clock-rates = <360000000>, <72000000>;
	power-domains = <&pd IMX_SC_R_CSI_0>, <&pd IMX_SC_R_ISI_CH0>;
	power-domain-names = "pd_csi", "pd_isi_ch0";
	status = "disabled";
};
ConnectCore 8X SBC Pro device tree
&mipi_csi_0 {
	#address-cells = <1>;
	#size-cells = <0>;
	/delete-property/virtual-channel;
	status = "disabled";

	/* Camera 0  MIPI CSI-2 (CSIS0) */
	port@0 {
		reg = <0>;
		mipi_csi0_ep: endpoint {
			remote-endpoint = <&ov5640_mipi_ep>;
			data-lanes = <1 2>;
		};
	};
};

Definition of the ISI selection

i.MX8QXP device tree
isi_0: isi@58100000 {
	compatible = "fsl,imx8-isi";
	reg = <0x58100000 0x10000>;
	interrupts = <GIC_SPI 297 IRQ_TYPE_LEVEL_HIGH>;
	interrupt-parent = <&gic>;
	clocks = <&pdma0_lpcg 0>;
	clock-names = "per";
	power-domains = <&pd IMX_SC_R_ISI_CH0>;
	interface = <2 0 2>;
	no-reset-control;
	status = "disabled";

	cap_device {
		compatible = "imx-isi-capture";
		status = "disabled";
	};

	m2m_device{
		compatible = "imx-isi-m2m";
		status = "disabled";
	};
};

Definition of the Camera sensor

The ConnectCore 8X SBC Pro device tree defines the MIPI-CSI2 OmniVision OV5640 camera.

ConnectCore 8X SBC Pro device tree
/* MIPI-CSI0 I2C available on MIPI Camera connector */
&i2c_mipi_csi0 {
	#address-cells = <1>;
	#size-cells = <0>;
	pinctrl-names = "default", "gpio";
	pinctrl-0 = <&pinctrl_csi0_lpi2c0>;
	pinctrl-1 = <&pinctrl_csi0_lpi2c0_gpio>;
	scl-gpios = <&lsio_gpio3 6 GPIO_ACTIVE_HIGH>;
	sda-gpios = <&lsio_gpio3 5 GPIO_ACTIVE_HIGH>;
	clock-frequency = <100000>;
	status = "disabled";

	/* MIPI-CSI2 camera */
	ov5640_mipi: ov5640_mipi@3c {
		compatible = "ovti,ov5640";
		reg = <0x3c>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_mipi>;
		clocks = <&xtal24m>;
		clock-names = "xclk";
		csi_id = <0>;
		reset-gpios = <&lsio_gpio3 21 GPIO_ACTIVE_LOW>;
		mclk = <24000000>;
		mclk_source = <0>;
		mipi_csi;
		status = "disabled";

		port {
			ov5640_mipi_ep: endpoint {
				remote-endpoint = <&mipi_csi0_ep>;
				data-lanes = <1 2>;
				clocks-lanes = <0>;
			};
		};
	};
};

IOMUX configuration

The MIPI interface uses dedicated pins.

On the ConnectCore 8X SBC Pro, GPIO3_21 of the CPU is routed to the MIPI connector for camera reset. The IOMUX for this GPIO is defined at the ConnectCore 8X SBC Pro device tree file:

ConnectCore 8X SBC Pro device tree
pinctrl_mipi: mipi {
	fsl,pins = <
		IMX8QXP_QSPI0B_DATA3_LSIO_GPIO3_IO21 0xC0000041
	>;
};