ITE: drivers/i2c/target: Cleanup the clear status flow of I2C target
IT8XXX2_I2C_STR is a register of read-only, non-writable to clear. Here we can set hardware reset bit in the IT8XXX2_I2C_CTR register to clear the status of IT8XXX2_I2C_STR. Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
This commit is contained in:
parent
43668c6416
commit
5de9203af3
1 changed files with 7 additions and 7 deletions
|
@ -966,10 +966,11 @@ static void target_i2c_isr(const struct device *dev)
|
||||||
|
|
||||||
/* Any error */
|
/* Any error */
|
||||||
if (target_status & E_TARGET_ANY_ERROR) {
|
if (target_status & E_TARGET_ANY_ERROR) {
|
||||||
/* Hardware reset */
|
goto end;
|
||||||
IT8XXX2_I2C_CTR(base) |= IT8XXX2_I2C_HALT;
|
}
|
||||||
|
|
||||||
/* Interrupt pending */
|
/* Interrupt pending */
|
||||||
} else if (target_status & IT8XXX2_I2C_INT_PEND) {
|
if (target_status & IT8XXX2_I2C_INT_PEND) {
|
||||||
uint8_t interrupt_status = IT8XXX2_I2C_IRQ_ST(base);
|
uint8_t interrupt_status = IT8XXX2_I2C_IRQ_ST(base);
|
||||||
|
|
||||||
/* Byte counter enable */
|
/* Byte counter enable */
|
||||||
|
@ -1021,14 +1022,13 @@ static void target_i2c_isr(const struct device *dev)
|
||||||
if (interrupt_status & IT8XXX2_I2C_P_CLR) {
|
if (interrupt_status & IT8XXX2_I2C_P_CLR) {
|
||||||
/* Transfer done callback function */
|
/* Transfer done callback function */
|
||||||
target_cb->stop(data->target_cfg);
|
target_cb->stop(data->target_cfg);
|
||||||
/* Hardware reset */
|
|
||||||
IT8XXX2_I2C_CTR(base) |= IT8XXX2_I2C_HALT;
|
|
||||||
}
|
}
|
||||||
/* Write clear the peripheral status */
|
/* Write clear the peripheral status */
|
||||||
IT8XXX2_I2C_IRQ_ST(base) = interrupt_status;
|
IT8XXX2_I2C_IRQ_ST(base) = interrupt_status;
|
||||||
}
|
}
|
||||||
/* Write clear the target status */
|
end:
|
||||||
IT8XXX2_I2C_STR(base) = target_status;
|
/* Hardware reset */
|
||||||
|
IT8XXX2_I2C_CTR(base) |= IT8XXX2_I2C_HALT;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue