Issue using I2C4 on IMX8 BSP >=5.0

I am having an issue using the I2C4 on the Apalis IMX8QM module on BSP version 5.0 and above.

I am able to get I2C4 to work on the Boot to Qt for Embedded Linux 3.0.3 b2qt-apalis-imx8. I am using linux-toradex_BSP_3.04.-4 DTS file fsl-imx8qm-apalis-v1.1.dtsi by adding the following:

	pinctrl_lpi2c4: lpi2c4grp {
		fsl,pins = <
			SC_P_ENET1_MDC_DMA_I2C4_SCL		    0x04000020
			SC_P_ENET1_MDIO_DMA_I2C4_SDA		    0x04000020
		>;
	};	

&i2c4 {
pinctrl-names = “default”;
pinctrl-0 = <&pinctrl_lpi2c4>;
#address-cells = <1>;
#size-cells = <0>;
clock-frequency = <100000>;
status = “okay”;
};

With the above compiled .dtb and running…
i2cdetect -l Returns the following (i2c-6 is new i.e. I2C4)
i2c-3 i2c 5a810000.i2c I2C adapter
i2c-6 i2c 5a840000.i2c I2C adapter
i2c-4 i2c 5a820000.i2c I2C adapter
i2c-2 i2c 5a800000.i2c I2C adapter
i2c-5 i2c 5a830000.i2c I2C adapter

I tried the same basic commands (suitable for BSP 5) and the compile fails with “label i2c4 missing”.

I found the following missing in: imx8-ss-dma.dtsi

i2c4_lpcg: clock-controller@5ac40000 {
	compatible = "fsl,imx8qxp-lpcg";
	reg = <0x5ac40000 0x10000>;
	#clock-cells = <1>;
	clocks = <&clk IMX_SC_R_I2C_4 IMX_SC_PM_CLK_PER>,
		 <&dma_ipg_clk>;
	bit-offset = <0 16>;
	clock-output-names = "i2c4_lpcg_clk",
			     "i2c4_lpcg_ipg_clk";
	power-domains = <&pd IMX_SC_R_I2C_4>;
};

i2c4: i2c@5a840000 {
	reg = <0x5a840000 0x4000>;
	interrupts = <GIC_SPI 224 IRQ_TYPE_LEVEL_HIGH>;
	interrupt-parent = <&gic>;
	clocks = <&i2c4_lpcg 0>,
		 <&i2c4_lpcg 1>;
	clock-names = "per", "ipg";
	assigned-clocks = <&clk IMX_SC_R_I2C_4 IMX_SC_PM_CLK_PER>;
	assigned-clock-rates = <24000000>;
	power-domains = <&pd IMX_SC_R_I2C_4>;
	status = "disabled";
};

With the sections added in imx8-ss-dma.dtsi the DTB would now compile, but i2cdetect -l does Not return: 2c-6 i2c 5a840000.i2c

What am I missing?

You are not by any chance mixing and matching device tree resp. kernel of different versions, right? If not, could you please state the exact git hash of the sources you tried those with?

Marcel,

I am using toradex_5.4-2.1.x-imx with defconfig to build either/both imx8qm-apalis-v1.1-eval.dtb and imx8qm-apalis-ixora-v1.1.dtb. The image I downloaded using Toradex EasyInstaller 2.0b7 is??

uname -a returns:
Linux apalis-imx8 5.4.77-5.1.0-devel+git.8fc7bd5da76f #1 SMP PREEMPT Mon Nov 30 08:44:04 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux

Is there an example of how to use I2C4 on iMX8QM BSP5? I would really appreciate some direction.

Thanks,
Brian

Hi @BrianWeir,

Other user was comenting something similar as you.
See if the solution proposed in the discussion may help you:

Best regards,
André Curvello

André,

This Link you suggested fixed my problem:
root@apalis-imx8:~# i2cdetect -l
i2c-3 i2c 5a810000.i2c I2C adapter
i2c-6 i2c 5a840000.i2c I2C adapter
i2c-4 i2c 5a820000.i2c I2C adapter
i2c-2 i2c 5a800000.i2c I2C adapter
i2c-5 i2c 5a830000.i2c I2C adapter

i2c-6 above is the I2C4 on Apalis pins 251/253.

Thank You Very Much!

Regards,
Brian Weir

Thank you for update.