From patchwork Fri Mar 6 13:34:53 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ari Kauppi X-Patchwork-Id: 10359 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 n26Dbtol021200 for ; Fri, 6 Mar 2009 13:37:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756221AbZCFNgh (ORCPT ); Fri, 6 Mar 2009 08:36:37 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756211AbZCFNgh (ORCPT ); Fri, 6 Mar 2009 08:36:37 -0500 Received: from smtp.nokia.com ([192.100.122.230]:17070 "EHLO mgw-mx03.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756201AbZCFNgf (ORCPT ); Fri, 6 Mar 2009 08:36:35 -0500 Received: from esebh105.NOE.Nokia.com (esebh105.ntc.nokia.com [172.21.138.211]) by mgw-mx03.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id n26Da9vN006759; Fri, 6 Mar 2009 15:36:24 +0200 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by esebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 6 Mar 2009 15:35:25 +0200 Received: from mgw-int01.ntc.nokia.com ([172.21.143.96]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Fri, 6 Mar 2009 15:35:24 +0200 Received: from localhost.localdomain (ouped11936.nmp.nokia.com [172.23.119.36]) by mgw-int01.ntc.nokia.com (Switch-3.2.5/Switch-3.2.5) with ESMTP id n26DZKdK000650; Fri, 6 Mar 2009 15:35:23 +0200 From: Ari Kauppi To: ben-linux@fluff.org Cc: linux-omap@vger.kernel.org, linux-i2c@vger.kernel.org Subject: [PATCH 1/2] i2c: i2c-omap: Fix BUFSTAT_REG reading Date: Fri, 6 Mar 2009 15:34:53 +0200 Message-Id: <187aef71c7b1862caf6fe6a935ed94cdb64ca3fd.1236345858.git.Ext-Ari.Kauppi@nokia.com> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: References: X-OriginalArrivalTime: 06 Mar 2009 13:35:24.0959 (UTC) FILETIME=[67A38AF0:01C99E60] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Eero Nurkkala The number of bytes to be received is read from wrong place with all OMAPs with highspeed I2C support, which involves a FIFO and BUFSTAT_REG. It is the 6 bits starting from the bit 8 in the BUFSTAT_REG that indicate this amount of bytes to be read. Moreover, only the 6 LSB:s are relevant for the TXSTAT field. Signed-off-by: Eero Nurkkala Signed-off-by: Tony Lindgren Signed-off-by: Ari Kauppi Acked-by: Felipe Balbi --- drivers/i2c/busses/i2c-omap.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index be8ee2c..0c3ed41 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -675,8 +675,9 @@ omap_i2c_isr(int this_irq, void *dev_id) if (stat & OMAP_I2C_STAT_RRDY) num_bytes = dev->fifo_size; else - num_bytes = omap_i2c_read_reg(dev, - OMAP_I2C_BUFSTAT_REG); + num_bytes = (omap_i2c_read_reg(dev, + OMAP_I2C_BUFSTAT_REG) + >> 8) & 0x3F; } while (num_bytes) { num_bytes--; @@ -714,8 +715,9 @@ omap_i2c_isr(int this_irq, void *dev_id) if (stat & OMAP_I2C_STAT_XRDY) num_bytes = dev->fifo_size; else - num_bytes = omap_i2c_read_reg(dev, - OMAP_I2C_BUFSTAT_REG); + num_bytes = (omap_i2c_read_reg(dev, + OMAP_I2C_BUFSTAT_REG)) + & 0x3F; } while (num_bytes) { num_bytes--;