i2c: riic: Add `riic_bus_barrier()` to check bus availability
authorLad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Mon, 13 Jan 2025 12:26:42 +0000 (12:26 +0000)
committerWolfram Sang <wsa+renesas@sang-engineering.com>
Tue, 14 Jan 2025 12:01:30 +0000 (13:01 +0100)
commitb31addf2a08bc5c16dfd6eae8785546f3eea92b8
treec4b22ee15910fcee5e495c8754bb656b947d9c11
parent385bb1c2678b59db201831255b524a6d7f7a25ff
i2c: riic: Add `riic_bus_barrier()` to check bus availability

Introduce a new `riic_bus_barrier()` function to verify bus availability
before initiating an I2C transfer. This function enhances the bus
arbitration check by ensuring that the SDA and SCL lines are not held low,
in addition to checking the BBSY flag using `readb_poll_timeout()`.

Previously, only the BBSY flag was checked to determine bus availability.
However, it is possible for the SDA line to remain low even when BBSY = 0.
This new implementation performs an additional check on the SDA and SCL
lines to avoid potential bus contention issues.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
drivers/i2c/busses/i2c-riic.c