summaryrefslogtreecommitdiffstats
path: root/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0004-kernel-Revert-i2c-rcar-Support-ACK-by-HW-auto-restart-after-NACK.patch
blob: 5f23129f13a9755da8ae3cfd583f6b2dc884f754 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
From 4f249ca259008006d972ea76fd2b37a2558ea2f1 Mon Sep 17 00:00:00 2001
From: Petr Nechaev <petr.nechaev@cogentembedded.com>
Date: Mon, 2 Feb 2015 13:37:55 +0300
Subject: [PATCH] Revert "i2c: rcar: Support ACK by HW auto restart after
 NACK"

This reverts commit 4df6b2af6c0f795d810eb1e2e9411ad1cbbe4245.
---
 drivers/i2c/busses/i2c-rcar.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 18034cd..0e863f3 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -522,6 +522,7 @@ static irqreturn_t rcar_i2c_irq(int irq, void *ptr)
 
 		/* go to stop phase */
 		rcar_i2c_bus_phase(priv, RCAR_BUS_PHASE_STOP);
+		rcar_i2c_irq_mask(priv, RCAR_IRQ_OPEN_FOR_STOP);
 		rcar_i2c_flags_set(priv, ID_NACK);
 		rcar_i2c_status_bit_clear(priv, MNR);
 		goto out;
@@ -532,14 +533,8 @@ static irqreturn_t rcar_i2c_irq(int irq, void *ptr)
 	 */
 	if (msr & MST) {
 		dev_dbg(dev, "Stop\n");
-		if (rcar_i2c_flags_has(priv, ID_NACK)) {
-			/* don't set ID_DONE for expecting ACK
-					after auto-restart by HW */
-			rcar_i2c_status_bit_clear(priv, MST);
-		} else {
-			rcar_i2c_flags_set(priv, ID_DONE);
-			rcar_i2c_status_clear(priv);
-		}
+		rcar_i2c_flags_set(priv, ID_DONE);
+		rcar_i2c_status_clear(priv);
 		goto out;
 	}
 
@@ -616,10 +611,6 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
 					     rcar_i2c_flags_has(priv, ID_DONE),
 					     5 * HZ);
 		if (!timeout) {
-			if (rcar_i2c_flags_has(priv, ID_NACK)) {
-				ret = -ENXIO;
-				break;
-			}
 			ret = -ETIMEDOUT;
 			break;
 		}
@@ -627,6 +618,11 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
 		/*
 		 * error handling
 		 */
+		if (rcar_i2c_flags_has(priv, ID_NACK)) {
+			ret = -ENXIO;
+			break;
+		}
+
 		if (rcar_i2c_flags_has(priv, ID_ARBLOST)) {
 			ret = -EAGAIN;
 			break;
-- 
1.9.1