From patchwork Thu Jun 25 07:40:01 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 32332 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n5P7eOii013544 for ; Thu, 25 Jun 2009 07:40:24 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753722AbZFYHkI (ORCPT ); Thu, 25 Jun 2009 03:40:08 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753911AbZFYHkI (ORCPT ); Thu, 25 Jun 2009 03:40:08 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:47727 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753722AbZFYHkH (ORCPT ); Thu, 25 Jun 2009 03:40:07 -0400 Received: from dlep34.itg.ti.com ([157.170.170.115]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id n5P7e5lY004134 for ; Thu, 25 Jun 2009 02:40:10 -0500 Received: from legion.dal.design.ti.com (localhost [127.0.0.1]) by dlep34.itg.ti.com (8.13.7/8.13.7) with ESMTP id n5P7e1UJ018784; Thu, 25 Jun 2009 02:40:01 -0500 (CDT) Received: from senorita (senorita.am.dhcp.ti.com [128.247.75.1]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id n5P7e1903581; Thu, 25 Jun 2009 02:40:01 -0500 (CDT) Received: by senorita (Postfix, from userid 1000) id 496DFA10B; Thu, 25 Jun 2009 02:40:01 -0500 (CDT) From: Nishanth Menon To: L-o Cc: Jagadeesh , Ulrik , Nishanth Menon Subject: [PATCH] I2C:OMAP: fix status ack Date: Thu, 25 Jun 2009 02:40:01 -0500 Message-Id: <1245915601-6575-1-git-send-email-nm@ti.com> X-Mailer: git-send-email 1.5.4.3 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.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. Issue identified by Jagadeesh Pakaravoor and Ulrik Bech Hald. Signed-off-by: Nishanth Menon --- 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 ece0125..0db0051 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -651,7 +651,14 @@ omap_i2c_isr(int this_irq, void *dev_id) break; } - omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, stat); + /* + * Ack the stat in one go, but [rx]dr and [rx]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)); err = 0; if (stat & OMAP_I2C_STAT_NACK) {