]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
i2c: qup: Cleared the error bits in ISR
authorAbhishek Sahu <absahu@codeaurora.org>
Mon, 9 May 2016 12:44:30 +0000 (18:14 +0530)
committerWolfram Sang <wsa@the-dreams.de>
Fri, 15 Jul 2016 06:26:56 +0000 (15:26 +0900)
1. Current QCOM I2C driver hangs when sending data to address 0x03-0x07
in some scenarios. The QUP controller generates invalid write in this
case, since these addresses are reserved for different bus formats.

2. Also, the error handling is done by I2C QUP ISR in the case of DMA
mode. The state need to be RESET in case of any error for clearing the
available data in FIFO, which otherwise leaves the BAM DMA controller
in hang state.

This patch fixes the above two issues by clearing the error bits from
I2C and QUP status in ISR in case of I2C error, QUP error and resets
the QUP state to clear the FIFO data.

Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-qup.c

index 69849a95d479e584392216eb7a57d285f9f9c836..686f262e34f7d9fed9eb49591ce3731ee1b87ef3 100644 (file)
@@ -213,14 +213,16 @@ static irqreturn_t qup_i2c_interrupt(int irq, void *dev)
        bus_err &= I2C_STATUS_ERROR_MASK;
        qup_err &= QUP_STATUS_ERROR_FLAGS;
 
-       if (qup_err) {
-               /* Clear Error interrupt */
+       /* Clear the error bits in QUP_ERROR_FLAGS */
+       if (qup_err)
                writel(qup_err, qup->base + QUP_ERROR_FLAGS);
-               goto done;
-       }
 
-       if (bus_err) {
-               /* Clear Error interrupt */
+       /* Clear the error bits in QUP_I2C_STATUS */
+       if (bus_err)
+               writel(bus_err, qup->base + QUP_I2C_STATUS);
+
+       /* Reset the QUP State in case of error */
+       if (qup_err || bus_err) {
                writel(QUP_RESET_STATE, qup->base + QUP_STATE);
                goto done;
        }