From c9327186f6b4de713df30c52ee9ef7d791cdc243 Mon Sep 17 00:00:00 2001 From: David Wu Date: Thu, 18 Oct 2018 18:18:32 +0800 Subject: [PATCH] i2c: rk3x: Leave the irq handle if received nack irq In the TRX mode, if there was a nack signal at the hardware's tx, we can get start and nack ipd from the I2C_IPD register, which will enter nack process, send stop command, change the state to stop, and enter the handler of stop irq, but the stop irq may not be generated, it has a latency. So the log will like this: [ 69.961944] rk3x-i2c ff650000.i2c: unexpected irq in STOP: 0x10 [ 70.959690] rk3x-i2c ff650000.i2c: timeout, ipd: 0x00, state: 4 This error log will confuse us, it is not easier to locate the problem, we should get nack error at this time, and processing stop interrupt at the next, then complete this i2c job. Change-Id: I073ef288557b1b6f525d936e8f32d9d165c81ec4 Signed-off-by: David Wu --- drivers/i2c/busses/i2c-rk3x.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c index 2dbd8d8f6a3e..9b1db8160d1c 100644 --- a/drivers/i2c/busses/i2c-rk3x.c +++ b/drivers/i2c/busses/i2c-rk3x.c @@ -511,8 +511,10 @@ static irqreturn_t rk3x_i2c_irq(int irqno, void *dev_id) ipd &= ~REG_INT_NAKRCV; - if (!(i2c->msg->flags & I2C_M_IGNORE_NAK)) + if (!(i2c->msg->flags & I2C_M_IGNORE_NAK)) { rk3x_i2c_stop(i2c, -ENXIO); + goto out; + } } /* is there anything left to handle? */