]> asedeno.scripts.mit.edu Git - linux.git/commit
i2c: bcm2835: Protect against unexpected TXW/RXR interrupts
authorNoralf Trønnes <noralf@tronnes.org>
Mon, 3 Oct 2016 20:06:09 +0000 (22:06 +0200)
committerWolfram Sang <wsa@the-dreams.de>
Mon, 7 Nov 2016 00:48:31 +0000 (01:48 +0100)
commitd4030d75c7cbb434b2a3e5f6af5065879d2615a5
tree691ee9ff6f0dd52052d0f7c8e7cb4ff20127f55d
parente2474541032db65d02bf88b6a8c2f954654b443f
i2c: bcm2835: Protect against unexpected TXW/RXR interrupts

If an unexpected TXW or RXR interrupt occurs (msg_buf_remaining == 0),
the driver has no way to fill/drain the FIFO to stop the interrupts.
In this case the controller has to be disabled and the transfer
completed to avoid hang.

(CLKT | ERR) and DONE interrupts are completed in their own paths, and
the controller is disabled in the transfer function after completion.
Unite the code paths and do disabling inside the interrupt routine.

Clear interrupt status bits in the united completion path instead of
trying to do it on every interrupt which isn't necessary.
Only CLKT, ERR and DONE can be cleared that way.

Add the status value to the error value in case of TXW/RXR errors to
distinguish them from the other S_LEN error.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-bcm2835.c