Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i2c: designware: Add support for bus clear feature #6071

Merged
merged 1 commit into from
Mar 27, 2024

Conversation

pelwell
Copy link
Contributor

@pelwell pelwell commented Mar 26, 2024

Newer versions of the DesignWare I2C block support the detection of stuck signals, and a mechanism to recover from them. Add the required software support to the driver.

This change was prompted by the observation that reading a single byte from register 0 of a VEML7700 seems to cause it to issue an ACK too early, and the controller to complain about losing arbitration. There is a suspicion that this may be a more widespread problem, but at least this patch prevents the bus from locking up.

See: #6057

@pelwell
Copy link
Contributor Author

pelwell commented Mar 26, 2024

I can provoke the lockup using a VEML7700 by running:

$ i2cget -y 1 0x10 0; i2cget -y 1 0x10 0

Reading pairs of bytes, as expected by the device, does not exhibit the problem:

$ i2cget -y 1 0x10 0 w; i2cget -y 1 0x10 0 w

Newer versions of the DesignWare I2C block support the detection of
stuck signals, and a mechanism to recover from them. Add the required
software support to the driver.

This change was prompted by the observation that reading a single byte
from register 0 of a VEML7700 seems to cause it to issue an ACK too
early, and the controller to complain about losing arbitration. There
is a suspicion that this may be a more widespread problem, but at least
this patch prevents the bus from locking up.

See: raspberrypi#6057

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
@pelwell
Copy link
Contributor Author

pelwell commented Mar 26, 2024

It's also worth noting that the same sequence also causes an error on Pi 4 (and presumably the other members of the BCM2835 family). For anyone interested, the early ACK makes the read portion of the second access appear as another write, i.e:

SW10A00ASR10AvvNP
SW10A00ASW10NP

S=Start, W=Write, A=ACK, R=Read, N=NAK, P=Stop, vv=Variable value

@pelwell
Copy link
Contributor Author

pelwell commented Mar 26, 2024

The autobuilds have completed - running sudo rpi-update pulls/6071 will install a trial, beta kernel including this patch. Remember to back-up important data before installing, just in case.

@JinShil
Copy link
Contributor

JinShil commented Mar 27, 2024

I tested this on a number of different slave devices and did not observe any regressions.

@pelwell
Copy link
Contributor Author

pelwell commented Mar 27, 2024

Thanks - that's good to hear.

@pelwell pelwell merged commit 24cb07b into raspberrypi:rpi-6.6.y Mar 27, 2024
12 checks passed
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Mar 27, 2024
See: raspberrypi/linux#6076

kernel: i2c: designware: Add support for bus clear feature
See: raspberrypi/linux#6071

kernel: RTC PCF2131 support
See: raspberrypi/linux#6070

kernel: allo-boss-dac mute output when changing parameters
See: raspberrypi/linux#6074

kernel: dts: bcm2712: Add blpubkey nvram node
See: raspberrypi/linux#6073

kernel: drivers: sdhci-brcmstb: work around mystery CQE CMD_IDLE_TIMER trampling
See: raspberrypi/linux#6060

kernel: drm/vc4: Enable bg_fill if there are no planes enabled
See: raspberrypi/linux#6066

kernel: ARM: dts: bcm2712: Add the missing L1/L2/L3 cache information
See: raspberrypi/linux#6061
popcornmix added a commit to raspberrypi/rpi-firmware that referenced this pull request Mar 27, 2024
See: raspberrypi/linux#6076

kernel: i2c: designware: Add support for bus clear feature
See: raspberrypi/linux#6071

kernel: RTC PCF2131 support
See: raspberrypi/linux#6070

kernel: allo-boss-dac mute output when changing parameters
See: raspberrypi/linux#6074

kernel: dts: bcm2712: Add blpubkey nvram node
See: raspberrypi/linux#6073

kernel: drivers: sdhci-brcmstb: work around mystery CQE CMD_IDLE_TIMER trampling
See: raspberrypi/linux#6060

kernel: drm/vc4: Enable bg_fill if there are no planes enabled
See: raspberrypi/linux#6066

kernel: ARM: dts: bcm2712: Add the missing L1/L2/L3 cache information
See: raspberrypi/linux#6061
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants