driver: I2C: npcx: re-enable interrupts after bus error

When the I2C is in the target mode and encounters the bus error, the
driver has to reset the bus to recover the I2C hardware. However, when
the hardware is disabled, the interrupt enable bits are also cleared
automatically by design. As a result, we need to enable the interrupts
after resetting the I2C hardware.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
This commit is contained in:
Jun Lin 2024-01-16 13:17:42 +08:00 committed by Carles Cufí
parent 6529e316a5
commit d34cd3e311

View file

@ -770,8 +770,15 @@ static void i2c_ctrl_target_isr(const struct device *dev, uint8_t status)
inst->SMBCTL2 &= ~BIT(NPCX_SMBCTL2_ENABLE);
inst->SMBCTL2 |= BIT(NPCX_SMBCTL2_ENABLE);
/*
* Re-enable interrupts because they are turned off after the SMBus module
* is reset above.
*/
inst->SMBCTL1 |= BIT(NPCX_SMBCTL1_NMINTE) | BIT(NPCX_SMBCTL1_INTEN);
/* End of transaction */
data->oper_state = NPCX_I2C_IDLE;
LOG_DBG("target: Bus error on port%02x!", data->port);
return;
}