Skip to contentSkip to conversation

OMAP3: I2C: Errata i207: Clear wrong RDR interrupt

PATCH Superseded Manjunatha GK 3 participants 4 messages Apr 1, 2010 – Apr 21, 2010 2 messages not in the archive

Subsystems (4)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 OMAP3: I2C: Errata i207: Clear wrong RDR interrupt

Under certain rare conditions, I2C_STAT[13].RDR bit may be set and the corresponding interrupt fire, even there is no data in the receive FIFO, or the I2C data transfer is still ongoing. These spurious RDR events must be ignored by the software.

This patch handles and ignores RDR spurious interrupts.

---
 drivers/i2c/busses/i2c-omap.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
drivers/i2c/busses/i2c-omap.c +13 -0
index f2019d2..acf4076 100644
@@ -796,6 +796,19 @@ complete:
 		}
 		if (stat & (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR)) {
 			u8 num_bytes = 1;
+
+			/*
+			 * OMAP3 I2C Errata ID: i207
+			 * Under certain rare conditions, RDR could be set again
+			 * when the bus is busy, then clear and ignore the interrupt
+			 */
+			if (!(stat & OMAP_I2C_STAT_RRDY) && (stat &
+						OMAP_I2C_STAT_BB)) {
+				/* clear RDR */
+				omap_i2c_ack_stat(dev, stat & OMAP_I2C_STAT_RDR);
+				dev_err(dev->dev, "I2C: RDR when bus is busy.\n");
+				return IRQ_HANDLED;
+			}
 			if (dev->fifo_size) {
 				if (stat & OMAP_I2C_STAT_RRDY)
 					num_bytes = dev->fifo_size;
Signature · 1 line
1.6.0.4

A message that is not in the archive (sent off-list or not yet received): 1270124427-11208-1-git-send-email-manjugk-l0cyMroinI0@public.gmane.org

#2 lore raw

G, Manjunath Kondaiah had written, on 04/01/2010 07:20 AM, the following:

Quoted 28 lines

Under certain rare conditions, I2C_STAT[13].RDR bit may be set and the corresponding interrupt fire, even there is no data in the receive FIFO, or the I2C data transfer is still ongoing. These spurious RDR events must be ignored by the software.

This patch handles and ignores RDR spurious interrupts.

---
 drivers/i2c/busses/i2c-omap.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
drivers/i2c/busses/i2c-omap.c +3 -0
index f2019d2..acf4076 100644
@@ -796,6 +796,19 @@ complete:
 		}
 		if (stat & (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR)) {
 			u8 num_bytes = 1;
+
+			/*
+			 * OMAP3 I2C Errata ID: i207

drivers/i2c/busses/i2c-omap.c complete: · line 811

Quoted 10 lines
drivers/i2c/busses/i2c-omap.c +10 -0
+			 * Under certain rare conditions, RDR could be set again
+			 * when the bus is busy, then clear and ignore the interrupt
+			 */
+			if (!(stat & OMAP_I2C_STAT_RRDY) && (stat &
+						OMAP_I2C_STAT_BB)) {
+				/* clear RDR */
+				omap_i2c_ack_stat(dev, stat & OMAP_I2C_STAT_RDR);
+				dev_err(dev->dev, "I2C: RDR when bus is busy.\n");
+				return IRQ_HANDLED;
+			}

couple of comments after reading thru the errata:
a) the sequence in the errata doc is:
if (stat & OMAP_I2C_STAT_RDR) { /* This is cleaner that using an obtuse check using !(stat & OMAP_I2C_STAT_RRDY) */
omap_i2c_ack_stat(dev, stat & OMAP_I2C_STAT_RDR); /* dummy read - i
think this needs clarification as to why */

	if (omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG) & OMAP_I2C_STAT_BB) /* 

reason for the i2c_read_reg is because errata mentions a dummy stat read
which might mean something for BB -> I am not sure may need to be
checked with H/w team. */
continue; /* recheck - faster response compared to return and re
generate interrupt */
}

b) does this apply to OMAP2 and OMAP4?

(unrelated sidenote: my usual crib: we probably need an errata management system soon considering the erratas that are getting workedaround in code.. :( )..

Quoted 3 lines
drivers/i2c/busses/i2c-omap.c +0 -0
 			if (dev->fifo_size) {
 				if (stat & OMAP_I2C_STAT_RRDY)
 					num_bytes = dev->fifo_size;
Signature · 2 lines
Regards,
Nishanth Menon

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 54 lines · Nishanth Menon

G, Manjunath Kondaiah had written, on 04/01/2010 07:20 AM, the following:

Quoted 28 lines

Under certain rare conditions, I2C_STAT[13].RDR bit may be set and the corresponding interrupt fire, even there is no data in the receive FIFO, or the I2C data transfer is still ongoing. These spurious RDR events must be ignored by the software.

This patch handles and ignores RDR spurious interrupts.

---
drivers/i2c/busses/i2c-omap.c | 13 +++++++++++++

1 files changed, 13 insertions(+), 0 deletions(-)
drivers/i2c/busses/i2c-omap.c +3 -0
index f2019d2..acf4076 100644
@@ -796,6 +796,19 @@ complete:
 		}
 		if (stat & (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR)) {
 			u8 num_bytes = 1;
+
+			/*
+			 * OMAP3 I2C Errata ID: i207

drivers/i2c/busses/i2c-omap.c complete: · line 811

Quoted 10 lines
drivers/i2c/busses/i2c-omap.c +10 -0
+			 * Under certain rare conditions, RDR could be set again
+			 * when the bus is busy, then clear and ignore the interrupt
+			 */
+			if (!(stat & OMAP_I2C_STAT_RRDY) && (stat &
+						OMAP_I2C_STAT_BB)) {
+				/* clear RDR */
+				omap_i2c_ack_stat(dev, stat & OMAP_I2C_STAT_RDR);
+				dev_err(dev->dev, "I2C: RDR when bus is busy.\n");
+				return IRQ_HANDLED;
+			}

couple of comments after reading thru the errata:
a) the sequence in the errata doc is:
if (stat & OMAP_I2C_STAT_RDR) { /* This is cleaner that using an obtuse check using !(stat & OMAP_I2C_STAT_RRDY) */
omap_i2c_ack_stat(dev, stat & OMAP_I2C_STAT_RDR); /* dummy read - i
think this needs clarification as to why */

	if (omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG) & OMAP_I2C_STAT_BB)

/* reason for the i2c_read_reg is because errata mentions a dummy stat read which might mean something for BB -> I am not sure may need to be checked with H/w team. */
continue; /* recheck - faster response compared to return and re
generate interrupt */
}

Quoted 1 line

b) does this apply to OMAP2 and OMAP4?

Ok, should this be held for further discussion?

Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
#5 lore raw
In reply to a message not in the archive

Sorry for reopening closed discussion thread.

Quoted 63 lines

-----Original Message-----
From: Menon, Nishanth
Sent: Thursday, April 01, 2010 7:23 PM
To: G, Manjunath Kondaiah
Cc: [email protected]; [email protected]; [email protected]; Kalliguddi, Hema
Subject: Re: [PATCH] OMAP3: I2C: Errata i207: Clear wrong RDR
interrupt

G, Manjunath Kondaiah had written, on 04/01/2010 07:20 AM, the following:

Quoted 13 lines

Under certain rare conditions, I2C_STAT[13].RDR bit may be set and the corresponding interrupt fire, even there is no data in the receive FIFO, or the I2C data transfer is still ongoing. These spurious RDR events must be ignored by the software.

This patch handles and ignores RDR spurious interrupts.

Review

Quoted 5 lines
---
 drivers/i2c/busses/i2c-omap.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
(quoted diff) +0 -0

b/drivers/i2c/busses/i2c-omap.c

drivers/i2c/busses/i2c-omap.c complete: · line 802

Quoted 11 lines

index f2019d2..acf4076 100644

drivers/i2c/busses/i2c-omap.c +4 -0
@@ -796,6 +796,19 @@ complete:
 		}
 		if (stat & (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR)) {
 			u8 num_bytes = 1;
+
+			/*
+			 * OMAP3 I2C Errata ID: i207
+			 * Under certain rare conditions, RDR 

could be set again

drivers/i2c/busses/i2c-omap.c complete: · line 803

Quoted 1 line
drivers/i2c/busses/i2c-omap.c +1 -0
+			 * when the bus is busy, then clear and 

ignore the interrupt

drivers/i2c/busses/i2c-omap.c complete:

Quoted 5 lines
drivers/i2c/busses/i2c-omap.c +5 -0
+			 */
+			if (!(stat & OMAP_I2C_STAT_RRDY) && (stat &
+						OMAP_I2C_STAT_BB)) {
+				/* clear RDR */
+				omap_i2c_ack_stat(dev, stat & 

OMAP_I2C_STAT_RDR);

drivers/i2c/busses/i2c-omap.c complete: · line 809

Quoted 1 line
drivers/i2c/busses/i2c-omap.c +1 -0
+				dev_err(dev->dev, "I2C: RDR 

when bus is busy.\n");

drivers/i2c/busses/i2c-omap.c complete: · line 811

Quoted 2 lines
drivers/i2c/busses/i2c-omap.c +2 -0
+				return IRQ_HANDLED;
+			}

couple of comments after reading thru the errata:
a) the sequence in the errata doc is:
if (stat & OMAP_I2C_STAT_RDR) { /* This is cleaner that using an obtuse
check using !(stat & OMAP_I2C_STAT_RRDY) */

	omap_i2c_ack_stat(dev, stat & OMAP_I2C_STAT_RDR); /* 
dummy read - i 
think this needs clarification as to why */
	if (omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG) & 
Quoted 8 lines

OMAP_I2C_STAT_BB) /*
reason for the i2c_read_reg is because errata mentions a dummy stat read
which might mean something for BB -> I am not sure may need to be
checked with H/w team. */
continue; /* recheck - faster response compared
to return and re
generate interrupt */

The idea of using "continue" seems to be resulting in losing RDR data when errata sequence is hit(observed on one of the 3630sdp).

If errata workaround is not mentioning about this "continue" logic, then why should we use it here?

Thanks to kiran for identifying issue with latest errata fix version(v3/v4).

We need to remove "continue" from this logic. If it is acceptable, I will post V5 version.

-Manjunath--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html