I would like to update this thread.
We`ve dug into the datasheet one more time and it seems that i2c-imx controller has no such function.
It is very sad, if it is true. I hope that there is an adequate way to detect the stop condition.
For now, we`ve made up some workaround:
We check IBB bit after we`ve received each byte from a master. When master sends us the last byte he should release a bus and in this case IBB bit will be 0. But this method has a big drawback: it is not possible to predict how much time master will hold the bus after sending us the last byte. Thus we should wait some time before checking IBB bit. During our experiments we found that 50 microseconds seems to be enough time to be sure that it is the last byte (but all the same, very rarely it seems that we lose stop condition).
The part of our code that does this (I`m sorry for not providing full source code, but it is not finished for now, and frankly speaking it is very ugly):
static void i2c_imx_slave_isr_handler_tasklet(unsigned long i2c_imx_data)
{
/*
...
interrupt processing
...
*/
udelay(50);
status = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2SR);
if((status & I2SR_IBB) == 0) {
pr_alert("end of package");
i2c_slave_event(i2c_imx->slave, I2C_SLAVE_STOP, &data);
}
}