problem with i2c-imx driver

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

problem with i2c-imx driver

5,984 Views
v_pazienza
Contributor I

Hello,
we are working with a i.MX6ULL based board. We are using the debian distribution "Linux imx6ul-var-dart 4.9.88" customized by Variscite which is owner of the module we are using.
We are now making some further customization to use the module in our equipment, and everything worked fine.
On the i2c-3 bus we have 8 IO expander (PCA9555) and we have successfully handled them using the standard i2c driver. But we have then discovered that under particular circumstances due to HW noise one of the IO expander lock the bus, so we need a recovery function.
So we are trying to use the i2c-imx driver that has this functionality but we have problem.
We have configured the kernel in order to have:

CONFIG_I2C_GPIO=y
CONFIG_I2C_IMX=y

and have changed the device tree as it follows:

&i2c3 {
clock-frequency = <400000>;
status = "okay";
pca9555@0x20 {
compatible = "fsl,imx51-i2c", "fsl,imx21-i2c";
//pinctrl-names = "default";
reg = <0x20>;
pinctrl-names = "default", "gpio";
pinctrl-0 = <&pinctrl_i2c3>;
pinctrl-1 = <&pinctrl_i2c3_gpio>;
scl-gpios = <&gpio2 8 GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN>;
sda-gpios = <&gpio2 9 GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN>;
};
};

pinctrl_i2c3: i2c3grp {
fsl,pins = <
MX6UL_PAD_ENET2_RX_DATA0__I2C3_SCL 0x4001b8b0
MX6UL_PAD_ENET2_RX_DATA1__I2C3_SDA 0x4001b8b0
>;
};

pinctrl_i2c3_gpio: i2c3grp_gpio {
fsl,pins = <
MX6UL_PAD_ENET2_RX_DATA0__GPIO2_IO08 0x0001b8b0
MX6UL_PAD_ENET2_RX_DATA1__GPIO2_IO09 0x0001b8b0
>;
};

but the dmesg says:
[ 0.364131] i2c i2c-0: IMX I2C adapter registered
[ 0.364174] i2c i2c-0: can't use DMA, using PIO instead.
[ 0.366389] i2c i2c-1: IMX I2C adapter registered
[ 0.366428] i2c i2c-1: can't use DMA, using PIO instead.
[ 0.366977] imx-i2c 21a8000.i2c: can't get pinctrl, bus recovery not supported
[ 0.367775] i2c i2c-2: IMX I2C adapter registered
[ 0.367809] i2c i2c-2: can't use DMA, using PIO instead.
[ 0.369033] i2c i2c-3: IMX I2C adapter registered
[ 0.369071] i2c i2c-3: can't use DMA, using PIO instead.

So it seems there something wrong but we can't figure out what.

Could anyone please provide us a way to find the problem and how to use correcty the driver?

The complete device tree is in attachment.

Thanks in advance.

Vincenzo Pazienza

0 Kudos
Reply
4 Replies

5,011 Views
mus
Contributor III

I am having the same reset issue. iMX driver is not calling the reset. How did you solve this issue?

0 Kudos
Reply

5,011 Views
igorpadykov
NXP Employee
NXP Employee

Hi Vincenzo

if issue is only one  IO expander this may be specific PCA9555

issue (for example latching) and one can try to protect expander from

noise adding some protection diodes and filter capacitors on its outputs.

To narrow down issue one can try to remove PCA9555 and check if recovery function

works without it, testing with other i2c device.

NXP has MAX7310 expanders on i.MX6 Sabre AI designs, one can check its dts:

imx6qdl-sabreauto.dtsi\dts\boot\arm\arch - linux-imx - i.MX Linux kernel 

SABRE|Automotive-Infotainment|i.MX6 | NXP 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

5,011 Views
v_pazienza
Contributor I

Hello Igor,

first of all thanks for your quick answer.

The problem I have tried to describe, is not due to a wrong behavior of the PCA9555 but to some noise we are trying to filter as you said. Anyway we would like to use the i2c-imx driver in order to take advantage from the recovery functionality.

Our problem at this moment is strictly a SW problem: we are not able yet to configure the device tree (and maybe the kernel) to use the driver i2c-imx. Of course we have not customized the device tree in the right way, and we can't understand where the mistake is.

What we see in the dmesg is

[    0.366389] i2c i2c-1: IMX I2C adapter registered [    0.366428] i2c i2c-1: can't use DMA, using PIO instead. [    0.366977] imx-i2c 21a8000.i2c: can't get pinctrl, bus recovery not supported[    0.367775] i2c i2c-2: IMX I2C adapter registered [    0.367809] i2c i2c-2: can't use DMA, using PIO instead.

In the device tree you linked, if I understand well, the used driver is not the i2c-imx.

Do you have a dts example where the i2c-imx is used? Or do you have any suggestion to

investigate the problem?

Thanks a lot.

Regards

Vincenzo

0 Kudos
Reply

5,011 Views
igorpadykov
NXP Employee
NXP Employee

Hi Vincenzo

for I2C driver description one can look at sect.4.6 Inter-IC (I2C) attached Linux Manual.

NXP Linux L4.14.98    link
https://source.codeaurora.org/external/imx/linux-imx/tree/?h=imx_4.14.98_2.0.0_ga

Best regards
igor

0 Kudos
Reply