From patchwork Tue Jul 14 21:21:00 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sonasath, Moiz" X-Patchwork-Id: 35605 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 n6ELLvnE008722 for ; Tue, 14 Jul 2009 21:21:57 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755590AbZGNVVU (ORCPT ); Tue, 14 Jul 2009 17:21:20 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755982AbZGNVVU (ORCPT ); Tue, 14 Jul 2009 17:21:20 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:49438 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755590AbZGNVVT convert rfc822-to-8bit (ORCPT ); Tue, 14 Jul 2009 17:21:19 -0400 Received: from dlep36.itg.ti.com ([157.170.170.91]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id n6ELLDHQ010152; Tue, 14 Jul 2009 16:21:18 -0500 Received: from dlep20.itg.ti.com (localhost [127.0.0.1]) by dlep36.itg.ti.com (8.13.8/8.13.8) with ESMTP id n6ELLDdM008037; Tue, 14 Jul 2009 16:21:13 -0500 (CDT) Received: from dlee75.ent.ti.com (localhost [127.0.0.1]) by dlep20.itg.ti.com (8.12.11/8.12.11) with ESMTP id n6ELLDJv012906; Tue, 14 Jul 2009 16:21:13 -0500 (CDT) Received: from dlee06.ent.ti.com ([157.170.170.11]) by dlee75.ent.ti.com ([157.170.170.72]) with mapi; Tue, 14 Jul 2009 16:21:12 -0500 From: "Sonasath, Moiz" To: "linux-omap@vger.kernel.org" CC: "Kamat, Nishant" , Paul Walmsley Date: Tue, 14 Jul 2009 16:21:00 -0500 Subject: [PATCH 3/3] [OMAP:I2C]OMAP3430 Silicon Errata 1.153 Thread-Topic: [PATCH 3/3] [OMAP:I2C]OMAP3430 Silicon Errata 1.153 Thread-Index: AcoEwVKxELWjTDmWTnyveKTnlBauTwAB4B+w Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org When an XRDY/XDR is hit, wait for XUDF before writing data to DATA_REG. Otherwise some data bytes can be lost while transferring them from the memory to the I2C interface. Do a Busy-wait for XUDF, before writing data to DATA_REG. While waiting if there is NACK | AL, set the appropriate error flags, ack the pending interrupts and return from the ISR. Signed-off-by: Moiz Sonasath Signed-off-by: Vikram Pandita --- drivers/i2c/busses/i2c-omap.c | 24 +++++++++++++++++++++++- 1 files changed, 23 insertions(+), 1 deletions(-) diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 05b5e4c..8deaf87 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -672,9 +672,10 @@ omap_i2c_isr(int this_irq, void *dev_id) break; } + err = 0; +complete: omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, stat); - err = 0; if (stat & OMAP_I2C_STAT_NACK) { err |= OMAP_I2C_STAT_NACK; omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, @@ -764,6 +765,27 @@ omap_i2c_isr(int this_irq, void *dev_id) "data to send\n"); break; } + + /* + * OMAP3430 Errata 1.153: When an XRDY/XDR + * is hit, wait for XUDF before writing data + * to DATA_REG. Otherwise some data bytes can + * be lost while transferring them from the + * memory to the I2C interface. + */ + + if (cpu_is_omap34xx()) { + while (!(stat & OMAP_I2C_STAT_XUDF)) { + if (stat & (OMAP_I2C_STAT_NACK | OMAP_I2C_STAT_AL)) { + omap_i2c_ack_stat(dev, stat & (OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR)); + err |= OMAP_I2C_STAT_XUDF; + goto complete; + } + cpu_relax(); + stat = omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG); + } + } + omap_i2c_write_reg(dev, OMAP_I2C_DATA_REG, w); } omap_i2c_ack_stat(dev,