i2c: pxa: clear all master action bits in i2c_pxa_stop_message()
authorRussell King <rmk+kernel@armlinux.org.uk>
Wed, 6 May 2020 09:36:38 +0000 (10:36 +0100)
committerWolfram Sang <wsa@kernel.org>
Tue, 12 May 2020 10:37:15 +0000 (12:37 +0200)
If we timeout during a message transfer, the control register may
contain bits that cause an action to be set. Read-modify-writing the
register leaving these bits set may trigger the hardware to attempt
one of these actions unintentionally.

Always clear these bits when cleaning up after a message or after
a timeout.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
drivers/i2c/busses/i2c-pxa.c

index db739cce93acbe7393d83b338f1fb10041a7adf9..a72d07bdb7938ea3d5de25e3022e84bde5234df8 100644 (file)
@@ -795,11 +795,9 @@ static inline void i2c_pxa_stop_message(struct pxa_i2c *i2c)
 {
        u32 icr;
 
-       /*
-        * Clear the STOP and ACK flags
-        */
+       /* Clear the START, STOP, ACK, TB and MA flags */
        icr = readl(_ICR(i2c));
-       icr &= ~(ICR_STOP | ICR_ACKNAK);
+       icr &= ~(ICR_START | ICR_STOP | ICR_ACKNAK | ICR_TB | ICR_MA);
        writel(icr, _ICR(i2c));
 }