Skip to content

Commit 4d65845

Browse files
rayagondawsakernel
authored andcommitted
i2c: iproc: handle rx fifo full interrupt
Add code to handle IS_S_RX_FIFO_FULL_SHIFT interrupt to support master write request with >= 64 bytes. Iproc has a slave rx fifo size of 64 bytes. Rx fifo full interrupt (IS_S_RX_FIFO_FULL_SHIFT) will be generated when RX fifo becomes full. This can happen if master issues write request of more than 64 bytes. Signed-off-by: Rayagonda Kokatanur <[email protected]> Acked-by: Ray Jui <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent e21d797 commit 4d65845

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

drivers/i2c/busses/i2c-bcm-iproc.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ static void bcm_iproc_i2c_slave_init(
313313

314314
/* Enable interrupt register to indicate a valid byte in receive fifo */
315315
val = BIT(IE_S_RX_EVENT_SHIFT);
316+
/* Enable interrupt register to indicate Slave Rx FIFO Full */
317+
val |= BIT(IE_S_RX_FIFO_FULL_SHIFT);
316318
/* Enable interrupt register to indicate a Master read transaction */
317319
val |= BIT(IE_S_RD_EVENT_SHIFT);
318320
/* Enable interrupt register for the Slave BUSY command */
@@ -434,9 +436,15 @@ static bool bcm_iproc_i2c_slave_isr(struct bcm_iproc_i2c_dev *iproc_i2c,
434436
* events
435437
* Master-read : both IS_S_RX_EVENT_SHIFT and IS_S_RD_EVENT_SHIFT
436438
* events or only IS_S_RD_EVENT_SHIFT
439+
*
440+
* iproc has a slave rx fifo size of 64 bytes. Rx fifo full interrupt
441+
* (IS_S_RX_FIFO_FULL_SHIFT) will be generated when RX fifo becomes
442+
* full. This can happen if Master issues write requests of more than
443+
* 64 bytes.
437444
*/
438445
if (status & BIT(IS_S_RX_EVENT_SHIFT) ||
439-
status & BIT(IS_S_RD_EVENT_SHIFT)) {
446+
status & BIT(IS_S_RD_EVENT_SHIFT) ||
447+
status & BIT(IS_S_RX_FIFO_FULL_SHIFT)) {
440448
/* disable slave interrupts */
441449
val = iproc_i2c_rd_reg(iproc_i2c, IE_OFFSET);
442450
val &= ~iproc_i2c->slave_int_mask;
@@ -452,9 +460,14 @@ static bool bcm_iproc_i2c_slave_isr(struct bcm_iproc_i2c_dev *iproc_i2c,
452460
/* schedule tasklet to read data later */
453461
tasklet_schedule(&iproc_i2c->slave_rx_tasklet);
454462

455-
/* clear only IS_S_RX_EVENT_SHIFT interrupt */
456-
iproc_i2c_wr_reg(iproc_i2c, IS_OFFSET,
457-
BIT(IS_S_RX_EVENT_SHIFT));
463+
/*
464+
* clear only IS_S_RX_EVENT_SHIFT and
465+
* IS_S_RX_FIFO_FULL_SHIFT interrupt.
466+
*/
467+
val = BIT(IS_S_RX_EVENT_SHIFT);
468+
if (status & BIT(IS_S_RX_FIFO_FULL_SHIFT))
469+
val |= BIT(IS_S_RX_FIFO_FULL_SHIFT);
470+
iproc_i2c_wr_reg(iproc_i2c, IS_OFFSET, val);
458471
}
459472

460473
if (status & BIT(IS_S_TX_UNDERRUN_SHIFT)) {

0 commit comments

Comments
 (0)