public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/3] [OMAP:I2C]OMAP3430 Silicon Errata 1.153
@ 2009-07-14 21:21 Sonasath, Moiz
  2009-07-14 23:23 ` Nishanth Menon
  0 siblings, 1 reply; 20+ messages in thread
From: Sonasath, Moiz @ 2009-07-14 21:21 UTC (permalink / raw)
  To: linux-omap@vger.kernel.org; +Cc: Kamat, Nishant, Paul Walmsley


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<m-sonasath@ti.com>
Signed-off-by: Vikram Pandita<vikram.pandita@ti.com>
---
 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,
-- 
1.5.6.3


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [PATCH 3/3] [OMAP:I2C]OMAP3430 Silicon Errata 1.153
@ 2009-07-21 15:15 Sonasath, Moiz
  2009-08-03  7:35 ` Paul Walmsley
  0 siblings, 1 reply; 20+ messages in thread
From: Sonasath, Moiz @ 2009-07-21 15:15 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
  Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.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<m-sonasath-l0cyMroinI0@public.gmane.org>
Signed-off-by: Vikram pandita<vikram.pandita-l0cyMroinI0@public.gmane.org>
---
 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,
-- 
1.5.6.3

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2009-08-20 17:16 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-14 21:21 [PATCH 3/3] [OMAP:I2C]OMAP3430 Silicon Errata 1.153 Sonasath, Moiz
2009-07-14 23:23 ` Nishanth Menon
2009-07-15 15:40   ` Sonasath, Moiz
2009-07-15 21:43     ` Nishanth Menon
2009-07-15 22:23       ` Sonasath, Moiz
2009-07-15 22:27         ` Nishanth Menon
2009-07-15 22:29           ` Sonasath, Moiz
2009-07-15 22:31             ` Nishanth Menon
2009-07-15 22:37               ` Sonasath, Moiz
2009-07-15 23:03                 ` Nishanth Menon
2009-07-16 15:52                   ` Sonasath, Moiz
2009-07-20 16:54     ` Sonasath, Moiz
  -- strict thread matches above, loose matches on Subject: below --
2009-07-21 15:15 Sonasath, Moiz
2009-08-03  7:35 ` Paul Walmsley
2009-08-03 20:19   ` Sonasath, Moiz
     [not found]     ` <CD8CC2B65FEE304DA95744A5472698F202959C0D61-UmuGNrFEPrGIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2009-08-10 15:44       ` Sonasath, Moiz
2009-08-10 16:29         ` Paul Walmsley
2009-08-11 16:33           ` Sonasath, Moiz
     [not found]             ` <CD8CC2B65FEE304DA95744A5472698F20295A89A21-UmuGNrFEPrGIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2009-08-16 17:39               ` Paul Walmsley
     [not found]                 ` <alpine.DEB.2.00.0908160841160.31720-rwI8Ez+7Ko+d5PgPZx9QOdBPR1lH4CV8@public.gmane.org>
2009-08-20 17:16                   ` Sonasath, Moiz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox