aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2012-09-12 06:58:04 -0400
committerWolfram Sang <w.sang@pengutronix.de>2012-09-12 09:02:50 -0400
commit1d7afc95946487945cc7f5019b41255b72224b70 (patch)
tree001376661d82bfb02dde2cad4e5ddcaa2a6489fc /drivers
parent66b9298878742f08cb6e79b7c7d5632d782fd1e1 (diff)
i2c: omap: ack IRQ in parts
According to flow diagrams on OMAP TRMs, we should ACK the IRQ as they happen. Signed-off-by: Felipe Balbi <balbi@ti.com> [Ack the stat OMAP_I2C_STAT_AL in case of arbitration lost] Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/busses/i2c-omap.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 40451341c479..bac1f11cc64b 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -850,21 +850,19 @@ omap_i2c_isr(int this_irq, void *dev_id)
850 } 850 }
851 851
852complete: 852complete:
853 /* 853 if (stat & OMAP_I2C_STAT_NACK) {
854 * Ack the stat in one go, but [R/X]DR and [R/X]RDY should be
855 * acked after the data operation is complete.
856 * Ref: TRM SWPU114Q Figure 18-31
857 */
858 omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, stat &
859 ~(OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR |
860 OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR));
861
862 if (stat & OMAP_I2C_STAT_NACK)
863 err |= OMAP_I2C_STAT_NACK; 854 err |= OMAP_I2C_STAT_NACK;
855 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_NACK);
856 omap_i2c_complete_cmd(dev, err);
857 return IRQ_HANDLED;
858 }
864 859
865 if (stat & OMAP_I2C_STAT_AL) { 860 if (stat & OMAP_I2C_STAT_AL) {
866 dev_err(dev->dev, "Arbitration lost\n"); 861 dev_err(dev->dev, "Arbitration lost\n");
867 err |= OMAP_I2C_STAT_AL; 862 err |= OMAP_I2C_STAT_AL;
863 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_AL);
864 omap_i2c_complete_cmd(dev, err);
865 return IRQ_HANDLED;
868 } 866 }
869 867
870 /* 868 /*
@@ -941,12 +939,18 @@ complete:
941 939
942 if (stat & OMAP_I2C_STAT_ROVR) { 940 if (stat & OMAP_I2C_STAT_ROVR) {
943 dev_err(dev->dev, "Receive overrun\n"); 941 dev_err(dev->dev, "Receive overrun\n");
944 dev->cmd_err |= OMAP_I2C_STAT_ROVR; 942 err |= OMAP_I2C_STAT_ROVR;
943 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_ROVR);
944 omap_i2c_complete_cmd(dev, err);
945 return IRQ_HANDLED;
945 } 946 }
946 947
947 if (stat & OMAP_I2C_STAT_XUDF) { 948 if (stat & OMAP_I2C_STAT_XUDF) {
948 dev_err(dev->dev, "Transmit underflow\n"); 949 dev_err(dev->dev, "Transmit underflow\n");
949 dev->cmd_err |= OMAP_I2C_STAT_XUDF; 950 err |= OMAP_I2C_STAT_XUDF;
951 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_XUDF);
952 omap_i2c_complete_cmd(dev, err);
953 return IRQ_HANDLED;
950 } 954 }
951 } while (stat); 955 } while (stat);
952 956