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 CSI Controller (CONFIG_IMX8_PARALLEL_CSI)

  • Maxim OV5640_V3 driver support (CONFIG_MXC_CAMERA_OV5640_V3)

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

Omnivision OV5640 CSI camera sensor driver

drivers/media/platform/imx8/mxc-parallel-csi.c

iMX8 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

i.MX8QXP device tree
parallel_csi: pcsi@58261000 {
	compatible = "fsl,mxc-parallel-csi";
	reg = <0x0 0x58261000 0x0 0x1000>;
	clocks = <&clk IMX8QXP_PARALLEL_CSI_PIXEL_CLK>,
		    <&clk IMX8QXP_PARALLEL_CSI_IPG_CLK>,
		    <&clk IMX8QXP_PARALLEL_CSI_CLK_SEL>,
		    <&clk IMX8QXP_PARALLEL_CSI_PER_CLK_DIV>,
		    <&clk IMX8QXP_PARALLEL_CSI_CLK_DPLL>;
	clock-names = "pixel", "ipg", "sel", "div", "dpll";
	assigned-clocks = <&clk IMX8QXP_PARALLEL_CSI_CLK_SEL>,
					<&clk IMX8QXP_PARALLEL_CSI_PER_CLK_DIV>;
	assigned-clock-parents = <&clk IMX8QXP_PARALLEL_CSI_CLK_DPLL>;
	assigned-clock-rates = <0>, <160000000>;  /* 160MHz */
	power-domains = <&pd_parallel_csi>;
	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

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";
};
ConnectCore 8X SBC Pro device tree
&isi_0 {
	interface = <6 0 2>;	/* INPUT: 6-PARALLEL CSI */
	parallel_csi;
	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_v3";
		reg = <0x3c>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_parallel_csi>;
		clocks = <&clk IMX8QXP_PARALLEL_CSI_MISC0_CLK>;
		clock-names = "csi_mclk";
		pwn-gpios = <&gpio3 2 GPIO_ACTIVE_LOW>;
		rst-gpios = <&gpio3 3 GPIO_ACTIVE_HIGH>;
		csi_id = <0>;
		mclk = <24000000>;
		mclk_source = <0>;
		status = "okay"

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

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.

To enable the camera:

  • Enable the parallel_csi node on the platform device tree (the node is commented by default):

ConnectCore 8X SBC Pro device tree
/*
 * Enable only if the parallel camera is physically connected.
 * If not, the MIPI camera may not work.
 * Similarly, if the MIPI camera is not physically connected you need to
 * disable the MIPI (mipi_csi_0) so that the parallel camera works.
 */
// &parallel_csi {
//        status = "okay";
// };