i2c: mxs: detect No Slave Ack on SELECT in PIO mode
authorJanusz Użycki <j.uzycki@elproma.com.pl>
Tue, 23 Sep 2014 10:48:26 +0000 (12:48 +0200)
committerWolfram Sang <wsa@the-dreams.de>
Fri, 3 Oct 2014 01:35:49 +0000 (03:35 +0200)
i2cdetect scanned i2c bus slow because the i2c-mxs driver ignored the
NO_SLAVE_ACK bit during busy-waiting loop. Thanks to the patch, the
speedup happens.

Signed-off-by: Janusz Uzycki <j.uzycki@elproma.com.pl>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-mxs.c

index 65a21fed08b5223dbccbe76296082e98314505ba..07e1be6f8992effc396aee4f8a1f382788ef7a0a 100644 (file)
@@ -307,6 +307,9 @@ static int mxs_i2c_pio_wait_xfer_end(struct mxs_i2c_dev *i2c)
        unsigned long timeout = jiffies + msecs_to_jiffies(1000);
 
        while (readl(i2c->regs + MXS_I2C_CTRL0) & MXS_I2C_CTRL0_RUN) {
+               if (readl(i2c->regs + MXS_I2C_CTRL1) &
+                               MXS_I2C_CTRL1_NO_SLAVE_ACK_IRQ)
+                       return -ENXIO;
                if (time_after(jiffies, timeout))
                        return -ETIMEDOUT;
                cond_resched();