This chapter describes the Parallel Capture Interface. This module interfaces the chip to the Parallel CSI sensor. This subsystem handles the sensor/image input and processing for all input imaging devices.

The Parallel CSI driver manages the Parallel Capture Interface and the communication to the ISI (Image Sensing Interface).

On the ConnectCore 8X SBC Pro, the Parallel CSI camera port is connected to port I2C3.

Kernel configuration

You can manage the Parallel CSI driver and the Omnivision OV5640 Parallel CSI camera sensor driver through the kernel configuration options:

  • IMX8 Parallel Capture Controller (CONFIG_IMX8_PARALLEL_CSI)

  • OmniVision OV5640 sensor support (CONFIG_VIDEO_OV5640)

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

Kernel driver

The driver for Parallel CSI capture is available at the following location:

File Description

drivers/media/i2c/ov5640.c

OV5640 MIPI Camera Subdev Driver

drivers/staging/media/imx/imx8-parallel-csi.c

MXC PARALLEL CSI driver

Device tree bindings and customization

The device tree must contain entries for:

  • The Parallel CSI interface

  • The ISI interface

  • The I2C interface

  • The camera sensor

Definition of the Parallel CSI interface

{cpu-family} device tree
parallel_csi: pcsi@58261000 {
	compatible = "fsl,mxc-parallel-csi";
	reg = <0x58261000 0x1000>;
	clocks = <&pi0_pxl_lpcg 0>,
		 <&pi0_ipg_lpcg 0>,
		 <&clk IMX_SC_R_PI_0 IMX_SC_PM_CLK_PER>,
		 <&clk IMX_SC_R_PI_0_PLL IMX_SC_PM_CLK_PLL>;
	clock-names = "pixel", "ipg", "div", "dpll";
	assigned-clocks = <&clk IMX_SC_R_PI_0 IMX_SC_PM_CLK_PER>;
	assigned-clock-parents = <&clk IMX_SC_R_PI_0_PLL IMX_SC_PM_CLK_PLL>;
	assigned-clock-rates = <160000000>;  /* 160MHz */
	power-domains = <&pd IMX_SC_R_PI_0>, <&pd IMX_SC_R_ISI_CH0>;
	power-domain-names = "pd_pi", "pd_isi_ch0";
	status = "disabled";
};
ConnectCore 8X SBC Pro device tree
&cameradev {
	parallel_csi;
};

&parallel_csi {
	#address-cells = <1>;
	#size-cells = <0>;
	status = "disabled";

	port@0 {
		reg = <0>;
		parallel_csi_ep: endpoint {
			remote-endpoint = <&ov5640_ep>;
		};
	};
};

Definition of the ISI selection

{cpu-family} 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";
	};
};
ConnectCore 8X SBC Pro device tree
&isi_0 {
	interface = <6 0 2>;	/* INPUT: 6-PARALLEL CSI */
	parallel_csi;
	status = "okay"
	cap_device {
		status = "okay";
	};
};

Definition of the Camera sensor

The ConnectCore 8X SBC Pro device tree defines the Parallel CSI OmniVision OV5640 camera.

ConnectCore 8X SBC Pro device tree
&i2c3 {
	#address-cells = <1>;
	#size-cells = <0>;
	clock-frequency = <100000>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_lpi2c3>;
	status = "okay"

	/* CSI Parallel Camera */
	ov5640: ov5640@3c {
		compatible = "ovti,ov5640";
		reg = <0x3c>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_parallel_csi>;
		clocks = <&pi0_misc_lpcg 0>;
		assigned-clocks = <&pi0_misc_lpcg 0>;
		assigned-clock-rates = <24000000>;
		clock-names = "xclk";
		powerdown = <&lsio_gpio3 2 GPIO_ACTIVE_LOW>;
		reset = <&lsio_gpio3 3 GPIO_ACTIVE_HIGH>;
		csi_id = <0>;
		mclk = <24000000>;
		mclk_source = <0>;
		status = "disabled";

		port {
			ov5640_ep: endpoint {
				remote-endpoint = <&parallel_csi_ep>;
				bus-type = <5>; /* V4L2_FWNODE_BUS_TYPE_PARALLEL */
				bus-width = <8>;
				vsync-active = <0>;
				hsync-active = <1>;
				pclk-sample = <1>;
			};
		};
	};
};

IOMUX configuration

The Parallel CSI interface uses dedicated pins.

On the ConnectCore 8X SBC Pro, GPIO3_IO03 of the CPU is routed to the Parallel CSI connector for the camera reset, and GPIO3_IO02 of the CPU is routed to the Parallel CSI connector for the camera enable. The IOMUX for this GPIO is defined at the ConnectCore 8X SBC Pro device tree file:

ConnectCore 8X SBC Pro device tree
pinctrl_parallel_csi: parallelcsigrp {
	fsl,pins = <
		SC_P_CSI_D00_CI_PI_D02		0xC0000041
		SC_P_CSI_D01_CI_PI_D03		0xC0000041
		SC_P_CSI_D02_CI_PI_D04		0xC0000041
		SC_P_CSI_D03_CI_PI_D05		0xC0000041
		SC_P_CSI_D04_CI_PI_D06		0xC0000041
		SC_P_CSI_D05_CI_PI_D07		0xC0000041
		SC_P_CSI_D06_CI_PI_D08		0xC0000041
		SC_P_CSI_D07_CI_PI_D09		0xC0000041

		SC_P_CSI_MCLK_CI_PI_MCLK	0xC0000041
		SC_P_CSI_PCLK_CI_PI_PCLK	0xC0000041
		SC_P_CSI_HSYNC_CI_PI_HSYNC	0xC0000041
		SC_P_CSI_VSYNC_CI_PI_VSYNC	0xC0000041
		/* CSI Camera enable */
		SC_P_CSI_EN_LSIO_GPIO3_IO02	0xC0000041
		/* CSI Camera reset */
		SC_P_CSI_RESET_LSIO_GPIO3_IO03	0xC0000041
	>;
};

Enabling the camera

On the ConnectCore 8X SBC Pro, the camera is disabled in the default device tree because if it is not physically connected the MIPI camera may not work.

The BSP contains a device tree overlay called _ov_board_parallel-camera_ccimx8x-sbc-pro.dtbo for the parallel camera. See Digi device tree overlays mechanism for information on enabling a device tree overlay.