Re: [PATCH V3] i2c: tegra: Add Bus Clear Master Support

From: Dmitry Osipenko
Date: Tue Jan 22 2019 - 18:39:12 EST


Ð Tue, 22 Jan 2019 23:26:08 +0000
Sowjanya Komatineni <skomatineni@xxxxxxxxxx> ÐÐÑÐÑ:

> >> >> + if (i2c_dev->msg_err == I2C_ERR_ARBITRATION_LOST) {
> >> >> + if (!i2c_dev->is_multimaster_mode)
> >> >> + return
> >> >> tegra_i2c_issue_bus_clear(i2c_dev);
> >> >> + return -EAGAIN;
> >> >
> >> >This changes the returned errno from -EIO to -EAGAIN for the
> >> >supports_bus_clear=false case, is it okay and intentional?
> >> >
> >>
> >> Yes EAGAIN is intentional to allow for transfer retry.
> >> During single master mode, ARBITRATION LOST notification happens
> >> when 1. I2C Master sees the bus is occupied by some other device
> >> when a transfer is initiated 2. I2C Master lost the bus during
> >> arbitration incase if slave device pulls SDA line low continuously
> >> for some unknown reason If arbitration lost is due to cause 1,
> >> retry helps to continue with transfer once bus is released by the
> >> slave and it just added delay in communication due to bus release
> >> delay by slave. In case of 2nd cause, retry never succeeds in
> >> cases where bus clear is not supported.
> >
> >It's unclear whether the "never succeeds retry" may fail with the
> >EAGAIN, causing an endless retry-loop. Could you please clarify this
> >moment?
>
> during master transmit mode, on arbitration lost and if master
> doesnât support bus clear to recover then transfer will return
> EAGAIN. I2c core base driver performs retries if return code from
> i2c_transfer is EAGAIN up to specified retries in i2c adapter and
> returns the ret code from the last retry. Retry is not endless as i2c
> core base performs retry only up to specified adapter retries.
> Following return code from documentation
> https://www.kernel.org/doc/Documentation/i2c/fault-codes
>
>

Good, thanks for the clarification.