Merge tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[cascardo/linux.git] / drivers / i2c / busses / i2c-omap.c
index 9f5b57a..0e89419 100644 (file)
@@ -344,8 +344,10 @@ static int omap_i2c_reset(struct omap_i2c_dev *dev)
                /* SYSC register is cleared by the reset; rewrite it */
                omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG, sysc);
 
-               /* Schedule I2C-bus monitoring on the next transfer */
-               dev->bb_valid = 0;
+               if (dev->rev > OMAP_I2C_REV_ON_3430_3530) {
+                       /* Schedule I2C-bus monitoring on the next transfer */
+                       dev->bb_valid = 0;
+               }
        }
 
        return 0;
@@ -460,7 +462,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
        dev->scllstate = scll;
        dev->sclhstate = sclh;
 
-       if (dev->rev < OMAP_I2C_OMAP1_REV_2) {
+       if (dev->rev <= OMAP_I2C_REV_ON_3430_3530) {
                /* Not implemented */
                dev->bb_valid = 1;
        }
@@ -1041,14 +1043,12 @@ omap_i2c_isr_thread(int this_irq, void *dev_id)
                if (stat & OMAP_I2C_STAT_NACK) {
                        err |= OMAP_I2C_STAT_NACK;
                        omap_i2c_ack_stat(dev, OMAP_I2C_STAT_NACK);
-                       break;
                }
 
                if (stat & OMAP_I2C_STAT_AL) {
                        dev_err(dev->dev, "Arbitration lost\n");
                        err |= OMAP_I2C_STAT_AL;
                        omap_i2c_ack_stat(dev, OMAP_I2C_STAT_AL);
-                       break;
                }
 
                /*
@@ -1073,11 +1073,13 @@ omap_i2c_isr_thread(int this_irq, void *dev_id)
                        if (dev->fifo_size)
                                num_bytes = dev->buf_len;
 
-                       omap_i2c_receive_data(dev, num_bytes, true);
-
-                       if (dev->errata & I2C_OMAP_ERRATA_I207)
+                       if (dev->errata & I2C_OMAP_ERRATA_I207) {
                                i2c_omap_errata_i207(dev, stat);
+                               num_bytes = (omap_i2c_read_reg(dev,
+                                       OMAP_I2C_BUFSTAT_REG) >> 8) & 0x3F;
+                       }
 
+                       omap_i2c_receive_data(dev, num_bytes, true);
                        omap_i2c_ack_stat(dev, OMAP_I2C_STAT_RDR);
                        continue;
                }
@@ -1399,7 +1401,6 @@ static int omap_i2c_remove(struct platform_device *pdev)
 }
 
 #ifdef CONFIG_PM
-#ifdef CONFIG_PM_RUNTIME
 static int omap_i2c_runtime_suspend(struct device *dev)
 {
        struct platform_device *pdev = to_platform_device(dev);
@@ -1437,7 +1438,6 @@ static int omap_i2c_runtime_resume(struct device *dev)
 
        return 0;
 }
-#endif /* CONFIG_PM_RUNTIME */
 
 static struct dev_pm_ops omap_i2c_pm_ops = {
        SET_RUNTIME_PM_OPS(omap_i2c_runtime_suspend,
@@ -1453,7 +1453,6 @@ static struct platform_driver omap_i2c_driver = {
        .remove         = omap_i2c_remove,
        .driver         = {
                .name   = "omap_i2c",
-               .owner  = THIS_MODULE,
                .pm     = OMAP_I2C_PM_OPS,
                .of_match_table = of_match_ptr(omap_i2c_of_match),
        },