AnsweredAssumed Answered

Incorrect handling of flags in the Linux I2C driver for LS2088?

Question asked by Martin Etnestad on Mar 14, 2017
Latest reply on Mar 16, 2017 by Pavel Chubakov

Hi!

 

We are in the process of debugging an issue in a multi-master I2C application, where the bus occasionally gets locked up.

Both masters are LS2088s running Linux, and we are aware of errata A-010124..

 

But while looking into the driver code (drivers/i2c/busses/i2c-imx.c), I believe I came across one or more bugs.

According to the reference manual, the IBAL and IBIF flags in IBSR should be cleared by writing a 1 to them.

However, the function i2c_imx_bus_busy(...) attempts to mask out the flag instead:

if (temp & I2SR_IAL) {
   temp &= ~I2SR_IAL;
   imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2SR);
   return -EAGAIN;
}

So if IBAL has become set, this code will never clear it. Instead, the I2C driver will return -EAGAIN forever.

This is actually exactly what we see in our application.

 

 

Investigating further, I found some struct definitions which provide hardware version-specific functions for, e.g., clearing flags.

But these are clearly not used consistently throughout the driver.

 

Can you please look into this?

 

Best regards,

    Martin Etnestad

Outcomes