linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Moiz Sonasath <m-sonasath-l0cyMroinI0@public.gmane.org>
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org,
	Nishanth Menon <nm-l0cyMroinI0@public.gmane.org>,
	Moiz Sonasath <m-sonasath-l0cyMroinI0@public.gmane.org>
Subject: [PATCH 1/3] i2c-omap: Fix I2C status ACK
Date: Thu, 20 Aug 2009 11:21:14 -0500	[thread overview]
Message-ID: <1250785276-31713-2-git-send-email-m-sonasath@ti.com> (raw)
In-Reply-To: <1250785276-31713-1-git-send-email-m-sonasath-l0cyMroinI0@public.gmane.org>

From: Nishanth Menon <nm-l0cyMroinI0@public.gmane.org>

I2C status ack for [RX]RDR and [RX]RDY could
cause race conditions of clearing the event
twice and a violation of the programing
sequence as defined in TRM This patch fixes
the same.

Signed-off-by: Nishanth Menon <nm-l0cyMroinI0@public.gmane.org>
Signed-off-by: Moiz Sonasath <m-sonasath-l0cyMroinI0@public.gmane.org>
---
 drivers/i2c/busses/i2c-omap.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index d258b02..94639d0 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -674,7 +674,14 @@ omap_i2c_isr(int this_irq, void *dev_id)
 
 		err = 0;
 complete:
-		omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, stat);
+		/*
+		 * Ack the stat in one go, but [R/X]DR and [R/X]RDY should be
+		 * acked after the data operation is complete.
+		 * Ref: TRM SWPU114Q Figure 18-31
+		 */
+		omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, stat &
+				~(OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR |
+				OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR));
 
 		if (stat & OMAP_I2C_STAT_NACK) {
 			err |= OMAP_I2C_STAT_NACK;
-- 
1.5.6.3

  parent reply	other threads:[~2009-08-20 16:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-20 16:21 [PATCH 0/3] i2c-omap: I2C clean-up patch Moiz Sonasath
     [not found] ` <1250785276-31713-1-git-send-email-m-sonasath-l0cyMroinI0@public.gmane.org>
2009-08-20 16:21   ` Moiz Sonasath [this message]
2009-08-20 16:21     ` [PATCH 2/3] i2c-omap: ACK pending [R/X]DR and [R/X]RDY interrupts Moiz Sonasath
     [not found]       ` <1250785276-31713-3-git-send-email-m-sonasath-l0cyMroinI0@public.gmane.org>
2009-08-20 16:21         ` [PATCH 3/3] i2c-omap: Enable workaround for Errata 1.153 based on Moiz Sonasath
2009-08-20 21:21   ` [PATCH 0/3] i2c-omap: I2C clean-up patch Ben Dooks

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1250785276-31713-2-git-send-email-m-sonasath@ti.com \
    --to=m-sonasath-l0cymroini0@public.gmane.org \
    --cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=nm-l0cyMroinI0@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).