Skip to content

Commit d982635

Browse files
Yicong Yangwsakernel
authored andcommitted
i2c: hisi: Only use the completion interrupt to finish the transfer
The controller will always generate a completion interrupt when the transfer is finished normally or not. Currently we use either error or completion interrupt to finish, this may result the completion interrupt unhandled and corrupt the next transfer, especially at low speed mode. Since on error case, the error interrupt will come first then is the completion interrupt. So only use the completion interrupt to finish the whole transfer process. Fixes: d62fbdb ("i2c: add support for HiSilicon I2C controller") Reported-by: Sheng Feng <[email protected]> Signed-off-by: Sheng Feng <[email protected]> Signed-off-by: Yicong Yang <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent cc9812a commit d982635

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/i2c/busses/i2c-hisi.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,11 @@ static irqreturn_t hisi_i2c_irq(int irq, void *context)
348348
hisi_i2c_read_rx_fifo(ctlr);
349349

350350
out:
351-
if (int_stat & HISI_I2C_INT_TRANS_CPLT || ctlr->xfer_err) {
351+
/*
352+
* Only use TRANS_CPLT to indicate the completion. On error cases we'll
353+
* get two interrupts, INT_ERR first then TRANS_CPLT.
354+
*/
355+
if (int_stat & HISI_I2C_INT_TRANS_CPLT) {
352356
hisi_i2c_disable_int(ctlr, HISI_I2C_INT_ALL);
353357
hisi_i2c_clear_int(ctlr, HISI_I2C_INT_ALL);
354358
complete(ctlr->completion);

0 commit comments

Comments
 (0)