997670716f2fac7a20c2dfae470111ec1d783213
[openwrt/staging/luka.git] /
1 From: Russell King <rmk+kernel@armlinux.org.uk>
2 Bcc: linux@mail.armlinux.org.uk
3 Subject: [PATCH 5/7] i2c: pxa: clear all master action bits in
4 i2c_pxa_stop_message()
5 MIME-Version: 1.0
6 Content-Disposition: inline
7 Content-Transfer-Encoding: 8bit
8 Content-Type: text/plain; charset="utf-8"
9
10 If we timeout during a message transfer, the control register may
11 contain bits that cause an action to be set. Read-modify-writing the
12 register leaving these bits set may trigger the hardware to attempt
13 one of these actions unintentionally.
14
15 Always clear these bits when cleaning up after a message or after
16 a timeout.
17
18 Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
19 ---
20 drivers/i2c/busses/i2c-pxa.c | 6 ++----
21 1 file changed, 2 insertions(+), 4 deletions(-)
22
23 diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
24 index db739cce93ac..a72d07bdb793 100644
25 --- a/drivers/i2c/busses/i2c-pxa.c
26 +++ b/drivers/i2c/busses/i2c-pxa.c
27 @@ -795,11 +795,9 @@ static inline void i2c_pxa_stop_message(struct pxa_i2c *i2c)
28 {
29 u32 icr;
30
31 - /*
32 - * Clear the STOP and ACK flags
33 - */
34 + /* Clear the START, STOP, ACK, TB and MA flags */
35 icr = readl(_ICR(i2c));
36 - icr &= ~(ICR_STOP | ICR_ACKNAK);
37 + icr &= ~(ICR_START | ICR_STOP | ICR_ACKNAK | ICR_TB | ICR_MA);
38 writel(icr, _ICR(i2c));
39 }
40
41 --
42 2.20.1
43