From patchwork Thu Aug 20 16:21:14 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sonasath, Moiz" X-Patchwork-Id: 42966 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 n7KGGYU9008354 for ; Thu, 20 Aug 2009 16:16:35 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754760AbZHTQQa (ORCPT ); Thu, 20 Aug 2009 12:16:30 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754815AbZHTQQa (ORCPT ); Thu, 20 Aug 2009 12:16:30 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:47609 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754760AbZHTQQ2 (ORCPT ); Thu, 20 Aug 2009 12:16:28 -0400 Received: from dlep34.itg.ti.com ([157.170.170.115]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id n7KGGIaU028202; Thu, 20 Aug 2009 11:16:24 -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 n7KGGI7Y015329; Thu, 20 Aug 2009 11:16:18 -0500 (CDT) Received: from lina0132712 (lina0132712.am.dhcp.ti.com [128.247.79.146]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id n7KGGHZ05752; Thu, 20 Aug 2009 11:16:17 -0500 (CDT) Received: by lina0132712 (Postfix, from userid 1000) id EE96D9D178; Thu, 20 Aug 2009 11:21:16 -0500 (CDT) From: Moiz Sonasath To: linux-i2c@vger.kernel.org Cc: linux-omap@vger.kernel.org, ben-linux@fluff.org, Nishanth Menon , Moiz Sonasath Subject: [PATCH 1/3] i2c-omap: Fix I2C status ACK Date: Thu, 20 Aug 2009 11:21:14 -0500 Message-Id: <1250785276-31713-2-git-send-email-m-sonasath@ti.com> X-Mailer: git-send-email 1.5.6.3 In-Reply-To: <1250785276-31713-1-git-send-email-m-sonasath@ti.com> References: <1250785276-31713-1-git-send-email-m-sonasath@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Nishanth Menon 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 Signed-off-by: Moiz Sonasath --- 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;