Skip to content

Commit 9340920

Browse files
shentokMichael Tokarev
authored andcommitted
hw/i2c/imx: Always set interrupt status bit if interrupt condition occurs
According to the i.MX 8M Plus reference manual, the status flag I2C_I2SR[IIF] continues to be set when an interrupt condition occurs even when I2C interrupts are disabled (I2C_I2CR[IIEN] is clear). However, the device model only sets the flag when I2C interrupts are enabled which causes U-Boot to loop forever. Fix the device model by always setting the flag and let I2C_I2CR[IIEN] guard I2C interrupts only. Also remove the comment in the code since it merely stated the obvious and would be outdated now. Cc: [email protected] Fixes: 20d0f9c ("i.MX: Add I2C controller emulator") Signed-off-by: Bernhard Beschow <[email protected]> Acked-by: Corey Minyard <[email protected]> Message-ID: <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]> (cherry picked from commit 54e54e5) Signed-off-by: Michael Tokarev <[email protected]>
1 parent bfa3f55 commit 9340920

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

hw/i2c/imx_i2c.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,12 @@ static void imx_i2c_reset(DeviceState *dev)
7979

8080
static inline void imx_i2c_raise_interrupt(IMXI2CState *s)
8181
{
82-
/*
83-
* raise an interrupt if the device is enabled and it is configured
84-
* to generate some interrupts.
85-
*/
86-
if (imx_i2c_is_enabled(s) && imx_i2c_interrupt_is_enabled(s)) {
82+
if (imx_i2c_is_enabled(s)) {
8783
s->i2sr |= I2SR_IIF;
88-
qemu_irq_raise(s->irq);
84+
85+
if (imx_i2c_interrupt_is_enabled(s)) {
86+
qemu_irq_raise(s->irq);
87+
}
8988
}
9089
}
9190

0 commit comments

Comments
 (0)