u32 val, err;
val = bcm2835_i2c_readl(i2c_dev, BCM2835_I2C_S);
+ bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_S,
+ BCM2835_I2C_S_CLKT |
+ BCM2835_I2C_S_ERR |
+ BCM2835_I2C_S_DONE);
bcm2835_debug_add(i2c_dev, val);
err = val & (BCM2835_I2C_S_CLKT | BCM2835_I2C_S_ERR);
}
if (val & BCM2835_I2C_S_DONE) {
+ if (val & BCM2835_I2C_S_TA)
+ return IRQ_HANDLED;
+
if (!i2c_dev->curr_msg) {
dev_err(i2c_dev->dev, "Got unexpected interrupt (from firmware?)\n");
} else if (i2c_dev->curr_msg->flags & I2C_M_RD) {
val = bcm2835_i2c_readl(i2c_dev, BCM2835_I2C_S);
}
- if ((val & BCM2835_I2C_S_RXD) || i2c_dev->msg_buf_remaining)
+ if (i2c_dev->msg_buf_remaining)
+ return IRQ_HANDLED;
+
+ if (val & BCM2835_I2C_S_RXD)
i2c_dev->msg_err = BCM2835_I2C_S_LEN;
else
i2c_dev->msg_err = 0;
complete:
bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, BCM2835_I2C_C_CLEAR);
- bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_S, BCM2835_I2C_S_CLKT |
- BCM2835_I2C_S_ERR | BCM2835_I2C_S_DONE);
complete(&i2c_dev->completion);
return IRQ_HANDLED;