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 support (CONFIG_IMX8_MIPI_CSI2)

  • Maxim OV5640_MIPI_V3 driver support (CONFIG_MXC_CAMERA_OV5640_MIPI_V3)

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/platform/imx8/ov5640_mipi_v3.c

OmniVision OV5640 MIPI camera sensor driver

drivers/media/platform/imx8/mxc-mipi-csi2.c

iMX8 MIPI CSI interface 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 = <0x0 0x58227000 0x0 0x1000>, /* CSI0 Controler base addr */
		<0x0 0x58221000 0x0 0x1000>; /* CSI0 Subsystem CSR base addr  */
	interrupts = <10 IRQ_TYPE_LEVEL_HIGH>;
	interrupt-parent = <&irqsteer_csi>;
	clocks = <&clk IMX8QXP_CLK_DUMMY>,
		<&clk IMX8QXP_CSI0_CORE_CLK>,
		<&clk IMX8QXP_CSI0_ESC_CLK>,
		<&clk IMX8QXP_IMG_PXL_LINK_CSI0_CLK>;
	clock-names = "clk_apb", "clk_core", "clk_esc", "clk_pxl";
	assigned-clocks = <&clk IMX8QXP_CSI0_CORE_CLK>,
			<&clk IMX8QXP_CSI0_ESC_CLK>;
	assigned-clock-rates = <360000000>, <72000000>;
	power-domains = <&pd_mipi_csi>;
	status = "disabled";
};
ConnectCore 8X SBC Pro device tree
&mipi_csi_0 {
	#address-cells = <1>;
	#size-cells = <0>;
	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 = <0x0 0x58100000 0x0 0x10000>;
	interrupts = <0 297 0>;
	interface = <2 0 2>;  /* Input MIPI_VCx Output
	Input:  0-DC0, 1-DC1, 2-MIPI CSI0, 3-MIPI CSI1, 4-HDMI, 5-MEM
	VCx:    0-VC0, 1-VC1, 2-VC2, 3-VC3, MIPI CSI only
	Output: 0-DC0, 1-DC1, 2-MEM */
	clocks = <&clk IMX8QXP_IMG_PDMA_0_CLK>;
	clock-names = "per";
	assigned-clocks = <&clk IMX8QXP_IMG_PDMA_0_CLK>;
	assigned-clock-rates = <600000000>;
	power-domains =<&pd_isi_ch0>;
	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
&i2c0_csi0 {
	#address-cells = <1>;
	#size-cells = <0>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_csi0_lpi2c0>;
	clock-frequency = <100000>;
	status = "disabled";

	/* MIPI-CSI2 camera */
	ov5640_mipi: ov5640_mipi@3c {
		compatible = "ovti,ov5640_mipi_v3";
		reg = <0x3c>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_mipi>;
		clocks = <&clk IMX8QXP_CLK_DUMMY>;
		clock-names = "csi_mclk";
		csi_id = <0>;
		rst-gpios = <&gpio3 21 GPIO_ACTIVE_HIGH>;
		mclk = <24000000>;
		mclk_source = <0>;
		mipi_csi;
		status = "disabled";

		port {
			ov5640_mipi_ep: endpoint {
				remote-endpoint = <&mipi_csi0_ep>;
			};
		};
	};
};

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 = <
		SC_P_QSPI0B_DATA3_LSIO_GPIO3_IO21 0xC0000041
	>;
};