!DRAFT! This document describes how to test if I2C bus recovery from the Linux I2C core was applied. A Renesas I2C IP core used on a Renesas Lager board serves as an example platform here.
Kernel Version and Configuration
Support for this feature is expected to land upstream in v4.16. It is currently available in a topic branch:
The following kernel options need to be set in addition to the defconfig:
Lager/r8a7790 (R-Car H2 SoC)
You need to connect the pins:
EXIO_C 78 <-> EXIO_A 58 (for SCL) EXIO_C 80 <-> EXIO_A 60 (for SDA)
This will connect the I2C1 and the I2C2 bus. We will use the I2C demultiplexer at runtime to switch I2C1 to GPIO:
# echo 2 > /sys/devices/platform/i2c-11/current_master
Only a busybox with standard commands like cd, cat, echo is needed.
As documented in the test page for I2C fault injection, an incomplete transfer to the audio codec resulted in the SDA line stuck low. It was concluded that "the audio codec does not have any timeout detection and there is no external chip to reactivate the bus. It is now the I2C bus masters turn to detect this condition and to recover the bus by toggling SCL."
Testing I2C bus recovery
You should go to the i2c fault injector directory and see the following files:
# cd /sys/kernel/debug/i2c-fault-injector/i2c-8/ # ls -1 incomplete_transfer scl sda
Please refer to the documentation file in Documentation/i2c/gpio-fault-injection about the meaning of the files.