Skip to content

Commit 0db9254

Browse files
Raviteja Narayanamwsakernel
authored andcommitted
Revert "i2c: cadence: Fix the hold bit setting"
This reverts commit d358def. There are two issues with "i2c: cadence: Fix the hold bit setting" commit. 1. In case of combined message request from user space, when the HOLD bit is cleared in cdns_i2c_mrecv function, a STOP condition is sent on the bus even before the last message is started. This is because when the HOLD bit is cleared, the FIFOS are empty and there is no pending transfer. The STOP condition should occur only after the last message is completed. 2. The code added by the commit is redundant. Driver is handling the setting/clearing of HOLD bit in right way before the commit. The setting of HOLD bit based on 'bus_hold_flag' is taken care in cdns_i2c_master_xfer function even before cdns_i2c_msend/cdns_i2c_recv functions. The clearing of HOLD bit is taken care at the end of cdns_i2c_msend and cdns_i2c_recv functions based on bus_hold_flag and byte count. Since clearing of HOLD bit is done after the slave address is written to the register (writing to address register triggers the message transfer), it is ensured that STOP condition occurs at the right time after completion of the pending transfer (last message). Signed-off-by: Raviteja Narayanam <[email protected]> Acked-by: Michal Simek <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent ba47d84 commit 0db9254

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

drivers/i2c/busses/i2c-cadence.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -594,10 +594,8 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id)
594594
* Check for the message size against FIFO depth and set the
595595
* 'hold bus' bit if it is greater than FIFO depth.
596596
*/
597-
if ((id->recv_count > CDNS_I2C_FIFO_DEPTH) || id->bus_hold_flag)
597+
if (id->recv_count > CDNS_I2C_FIFO_DEPTH)
598598
ctrl_reg |= CDNS_I2C_CR_HOLD;
599-
else
600-
ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD;
601599

602600
cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET);
603601

@@ -654,11 +652,8 @@ static void cdns_i2c_msend(struct cdns_i2c *id)
654652
* Check for the message size against FIFO depth and set the
655653
* 'hold bus' bit if it is greater than FIFO depth.
656654
*/
657-
if ((id->send_count > CDNS_I2C_FIFO_DEPTH) || id->bus_hold_flag)
655+
if (id->send_count > CDNS_I2C_FIFO_DEPTH)
658656
ctrl_reg |= CDNS_I2C_CR_HOLD;
659-
else
660-
ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD;
661-
662657
cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET);
663658

664659
/* Clear the interrupts in interrupt status register. */

0 commit comments

Comments
 (0)