Skip to content

Commit c3beabd

Browse files
MulinChaonashif
authored andcommitted
driver: i2c: npcx: clear status register by setting a single bit.
Since all fields' type in SMBST is R/W1C and RO, setting a single bit to clear a specified event is a more suitable solution. Or we might clear the other pending bits that occurred at the same moment unexpectedly. Signed-off-by: Mulin Chao <[email protected]>
1 parent 7c8cb78 commit c3beabd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/i2c/i2c_npcx_controller.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ static int i2c_ctrl_recovery(const struct device *dev)
427427
* - Wait for STOP condition completed
428428
* - Then clear BB (BUS BUSY) bit
429429
*/
430-
inst_fifo->SMBST |= BIT(NPCX_SMBST_BER) | BIT(NPCX_SMBST_NEGACK);
430+
inst_fifo->SMBST = BIT(NPCX_SMBST_BER) | BIT(NPCX_SMBST_NEGACK);
431431
ret = i2c_ctrl_wait_stop_completed(dev, I2C_MAX_TIMEOUT);
432432
inst_fifo->SMBCST |= BIT(NPCX_SMBCST_BB);
433433
if (ret != 0) {
@@ -686,7 +686,7 @@ static void i2c_ctrl_isr(const struct device *dev)
686686
i2c_ctrl_stop(dev);
687687

688688
/* Clear BER Bit */
689-
inst_fifo->SMBST |= BIT(NPCX_SMBST_BER);
689+
inst_fifo->SMBST = BIT(NPCX_SMBST_BER);
690690

691691
/* Make sure slave doesn't hold bus by reading FIFO again */
692692
tmp = i2c_ctrl_fifo_read(dev);
@@ -705,7 +705,7 @@ static void i2c_ctrl_isr(const struct device *dev)
705705
i2c_ctrl_stop(dev);
706706

707707
/* Clear NEGACK Bit */
708-
inst_fifo->SMBST |= BIT(NPCX_SMBST_NEGACK);
708+
inst_fifo->SMBST = BIT(NPCX_SMBST_NEGACK);
709709

710710
/* End transaction */
711711
data->oper_state = NPCX_I2C_WAIT_STOP;

0 commit comments

Comments
 (0)