Skip to content
Commit e2474541 authored by Noralf Trønnes's avatar Noralf Trønnes Committed by Wolfram Sang
Browse files

i2c: bcm2835: Fix hang for writing messages larger than 16 bytes



Writing messages larger than the FIFO size results in a hang, rendering
the machine unusable. This is because the RXD status flag is set on the
first interrupt which results in bcm2835_drain_rxfifo() stealing bytes
from the buffer. The controller continues to trigger interrupts waiting
for the missing bytes, but bcm2835_fill_txfifo() has none to give.
In this situation wait_for_completion_timeout() apparently is unable to
stop the madness.

The BCM2835 ARM Peripherals datasheet has this to say about the flags:
  TXD: is set when the FIFO has space for at least one byte of data.
  RXD: is set when the FIFO contains at least one byte of data.
  TXW: is set during a write transfer and the FIFO is less than full.
  RXR: is set during a read transfer and the FIFO is or more full.

Implementing the logic from the downstream i2c-bcm2708 driver solved
the hang problem.

Signed-off-by: default avatarNoralf Trønnes <noralf@tronnes.org>
Reviewed-by: default avatarEric Anholt <eric@anholt.net>
Reviewed-by: default avatarMartin Sperl <kernel@martin.sperl.org>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent bc33b0ca
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment