The MIPI camera sensor interface (MIPI CSI2) host controller is a digital core that implements all protocol functions, providing an interface between the system and the MIPI D-PHY and allowing communication with a MIPI CSI2-compliant camera sensor.

The MIPI CSI2 driver manages the MIPI D-PHY and coordinates with the MIPI sensor and IPU CSI. The MIPI CSI2 driver implements functions as follows:

  • MIPI CSI2 low-level interface for managing the MIPI D-PHY register and clock

  • MIPI CSI2 common API for communication between MIPI sensor and MIPI D-PHY

  • D-PHY

On the ConnectCore 6 SBC, the MIPI camera port is connected to port I2C3.

Kernel configuration

You can manage the MIPI driver support and Video4Linux (V4L2) capture driver through the kernel configuration options:

  • MXC MIPI support (CONFIG_MXC_MIPI_CSI2)

  • MXC video for Linux video capture (CONFIG_VIDEO_MXC_CAPTURE)

These options are enabled as built-in on the ConnectCore 6 SBC kernel configuration file.

The kernel configuration file enables support for OmniVision OV5640 MIPI camera sensor through the kernel configuration option:

  • OmniVision ov5640 camera support using MIPI (CONFIG_MXC_CAMERA_OV5640_MIPI)

Kernel driver

The drivers for MIPI capture are available at the following locations:

File Description

drivers/mxc/mipi/mxc_mipi_csi2.c

MIPI CSI2 driver

drivers/media/platform/mxc/capture/mxc_v4l2_capture.c

Video4Linux (V4L2) capture driver

drivers/media/platform/mxc/capture/ov5640_mipi.c

OmniVision OV5640 MIPI camera sensor driver

Device tree bindings and customization

The i.MX6 MIPI interface device tree binding is documented at Documentation/devicetree/bindings/video/fsl,mipi-csi2.txt.

The V4L2 framework device tree binding is documented at Documentation/devicetree/bindings/video/fsl,v4l2-capture.txt.

The device tree must contain entries for:

  • The MIPI interface

  • The Video4Linux (V4L2) capture interface

  • The camera sensor

Definition of the MIPI CSI interface

{cpu-family} device tree
mipi_csi: mipi_csi@21dc000 {
	compatible = "fsl,imx6q-mipi-csi2";
	reg = <0x021dc000 0x4000>;
	#address-cells = <1>;
	#size-cells = <0>;
	interrupts = <0 100 0x04>, <0 101 0x04>;
	clocks = <&clks IMX6QDL_CLK_HSI_TX>,
	         <&clks IMX6QDL_CLK_VIDEO_27M>,
	         <&clks IMX6QDL_CLK_EIM_SEL>;
	clock-names = "dphy_clk", "cfg_clk", "pixel_clk";
	status = "disabled";
};

MIPI IPU:DI selection and enabling

The video input to the MIPI is configurable and may come from any IPU present in the i.MX6 CPU and from either of the two CSI interfaces within each IPU: CSI0 or CSI1.

{cpu-family} device tree
&mipi_csi {
	v_channel = <0>;
	lanes = <2>;
	ipu_id = <1>;
	csi_id = <0>;
};

MIPI CSI V4L2 capture device

{cpu-family} device tree
v4l2_cap_0: v4l2-cap@0 {
	compatible = "fsl,imx6q-v4l2-capture";
	mclk_source = <0>;
	ipu_id = <1>;
	csi_id = <0>;
	status = "okay";
};

Camera sensor

The ConnectCore 6 SBC device tree defines the MIPI-CSI2 OmniVision OV5640 camera.

{cpu-family} device tree
&i2c3 {
	clock-frequency = <100000>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_i2c3>;
	status = "okay";
	/* MIPI-CSI2 camera */
	ov5640_mipi: ov5640_mipi@3c {
		compatible = "ovti,ov564x_mipi";
		reg = <0x3c>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_mipi>;
		clocks = <&clks 201>;
		clock-names = "csi_mclk";
		pwn-gpios = <&gpio7 6 GPIO_ACTIVE_LOW>;
		digi,alt-pwn-gpios = <&gpio5 0 GPIO_ACTIVE_LOW
		                      &gpio3 15 GPIO_ACTIVE_LOW>;
		mclk = <24000000>;
		mclk_source = <0>;
		ipu_id = <1>;
		csi_id = <0>;
	};
};

IOMUX configuration

The MIPI interface uses dedicated pins.

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

{cpu-family} device tree
mipi {
	pinctrl_mipi: mipi {
		fsl,pins = <
			MX6QDL_PAD_SD3_DAT2__GPIO7_IO06 0x80000000
		>;
	};
};
Although the driver supports an optional rst-gpios property for the camera sensor, the OmniVision camera board does not connect this line to the sensor so the ConnectCore 6 SBC device tree leaves this line in high impedance.