Skip to content

Commit 4bca93a

Browse files
Raviteja Narayanamwsakernel
authored andcommitted
i2c: xiic: Fix Tx Interrupt path for grouped messages
When a group of messages are sent from user space as a set, if the last message has less than Tx FIFO DEPTH number of bytes to transfer, Tx half empty interrupt is triggered continuously from the hardware. It is due to Bus not busy interrupt coming along with Tx half empty and tx empty. Hence, service the Tx interrupts before Bus not busy interrupt to update the i2c message status correctly. Signed-off-by: Raviteja Narayanam <raviteja.narayanam@xilinx.com> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com> Acked-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
1 parent b822039 commit 4bca93a

1 file changed

Lines changed: 20 additions & 18 deletions

File tree

drivers/i2c/busses/i2c-xiic.c

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -468,24 +468,6 @@ static irqreturn_t xiic_process(int irq, void *dev_id)
468468
}
469469
}
470470
}
471-
if (pend & XIIC_INTR_BNB_MASK) {
472-
/* IIC bus has transitioned to not busy */
473-
clr |= XIIC_INTR_BNB_MASK;
474-
475-
/* The bus is not busy, disable BusNotBusy interrupt */
476-
xiic_irq_dis(i2c, XIIC_INTR_BNB_MASK);
477-
478-
if (!i2c->tx_msg)
479-
goto out;
480-
481-
wakeup_req = 1;
482-
483-
if (i2c->nmsgs == 1 && !i2c->rx_msg &&
484-
xiic_tx_space(i2c) == 0)
485-
wakeup_code = STATE_DONE;
486-
else
487-
wakeup_code = STATE_ERROR;
488-
}
489471
if (pend & (XIIC_INTR_TX_EMPTY_MASK | XIIC_INTR_TX_HALF_MASK)) {
490472
/* Transmit register/FIFO is empty or ½ empty */
491473

@@ -522,6 +504,26 @@ static irqreturn_t xiic_process(int irq, void *dev_id)
522504
*/
523505
xiic_irq_dis(i2c, XIIC_INTR_TX_HALF_MASK);
524506
}
507+
508+
if (pend & XIIC_INTR_BNB_MASK) {
509+
/* IIC bus has transitioned to not busy */
510+
clr |= XIIC_INTR_BNB_MASK;
511+
512+
/* The bus is not busy, disable BusNotBusy interrupt */
513+
xiic_irq_dis(i2c, XIIC_INTR_BNB_MASK);
514+
515+
if (!i2c->tx_msg)
516+
goto out;
517+
518+
wakeup_req = 1;
519+
520+
if (i2c->nmsgs == 1 && !i2c->rx_msg &&
521+
xiic_tx_space(i2c) == 0)
522+
wakeup_code = STATE_DONE;
523+
else
524+
wakeup_code = STATE_ERROR;
525+
}
526+
525527
out:
526528
dev_dbg(i2c->adap.dev.parent, "%s clr: 0x%x\n", __func__, clr);
527529

0 commit comments

Comments
 (0)