linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] [OMAP:I2C]Bug in reading the RXSTAT/TXSTAT values from the I2C_BUFFSTAT register
@ 2009-07-21 15:14 Sonasath, Moiz
  2009-07-30  0:07 ` Ben Dooks
  0 siblings, 1 reply; 2+ messages in thread
From: Sonasath, Moiz @ 2009-07-21 15:14 UTC (permalink / raw)
  To: linux-i2c@vger.kernel.org; +Cc: linux-omap@vger.kernel.org

Fix bug in reading the I2C_BUFFSTAT register for getting byte count on RX/TX interrupt.

On Interrupt: I2C_STAT[RDR],
	read 'RXSTAT' from I2C_BUFFSTAT[8-13]
On Interrupt: I2C_STAT[XDR]
	read 'TXSTAT' from I2C_BUFFSTAT[0-5]

Signed-off-by: Jagadeesh Pakaravoor<j-pakaravoor@ti.com>
Signed-off-by: Moiz Sonasath<m-sonasath@ti.com>
Signed-off-by: Vikram pandita<vikram.pandita@ti.com>
---
 drivers/i2c/busses/i2c-omap.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index ad8d201..d280acf 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -692,9 +692,10 @@ omap_i2c_isr(int this_irq, void *dev_id)
 			if (dev->fifo_size) {
 				if (stat & OMAP_I2C_STAT_RRDY)
 					num_bytes = dev->fifo_size;
-				else
-					num_bytes = omap_i2c_read_reg(dev,
-							OMAP_I2C_BUFSTAT_REG);
+				else    /* read RXSTAT on RDR interrupt */
+					num_bytes = (omap_i2c_read_reg(dev,
+							OMAP_I2C_BUFSTAT_REG)
+							>> 8) & 0x3F;
 			}
 			while (num_bytes) {
 				num_bytes--;
@@ -731,9 +732,10 @@ omap_i2c_isr(int this_irq, void *dev_id)
 			if (dev->fifo_size) {
 				if (stat & OMAP_I2C_STAT_XRDY)
 					num_bytes = dev->fifo_size;
-				else
-					num_bytes = omap_i2c_read_reg(dev,
-							OMAP_I2C_BUFSTAT_REG);
+				else    /* read TXSTAT on XDR interrupt */
+					num_bytes = omap_i2c_read_reg(dev,
+							OMAP_I2C_BUFSTAT_REG)
+							& 0x3F;
 			}
 			while (num_bytes) {
 				num_bytes--;
-- 
1.5.6.3


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

* Re: [PATCH 1/3] [OMAP:I2C]Bug in reading the RXSTAT/TXSTAT values from the I2C_BUFFSTAT register
  2009-07-21 15:14 [PATCH 1/3] [OMAP:I2C]Bug in reading the RXSTAT/TXSTAT values from the I2C_BUFFSTAT register Sonasath, Moiz
@ 2009-07-30  0:07 ` Ben Dooks
  0 siblings, 0 replies; 2+ messages in thread
From: Ben Dooks @ 2009-07-30  0:07 UTC (permalink / raw)
  To: Sonasath, Moiz; +Cc: linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org

On Tue, Jul 21, 2009 at 10:14:06AM -0500, Sonasath, Moiz wrote:
> Fix bug in reading the I2C_BUFFSTAT register for getting byte count on RX/TX interrupt.
> 
> On Interrupt: I2C_STAT[RDR],
> 	read 'RXSTAT' from I2C_BUFFSTAT[8-13]
> On Interrupt: I2C_STAT[XDR]
> 	read 'TXSTAT' from I2C_BUFFSTAT[0-5]
> 
> Signed-off-by: Jagadeesh Pakaravoor<j-pakaravoor@ti.com>
> Signed-off-by: Moiz Sonasath<m-sonasath@ti.com>
> Signed-off-by: Vikram pandita<vikram.pandita@ti.com>

IIRC, email addresses should have a space between the real name
and the address part. I've fixed this when applying as well as
changing all subjects to start i2c-omap:

> ---
>  drivers/i2c/busses/i2c-omap.c |   14 ++++++++------
>  1 files changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index ad8d201..d280acf 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -692,9 +692,10 @@ omap_i2c_isr(int this_irq, void *dev_id)
>  			if (dev->fifo_size) {
>  				if (stat & OMAP_I2C_STAT_RRDY)
>  					num_bytes = dev->fifo_size;
> -				else
> -					num_bytes = omap_i2c_read_reg(dev,
> -							OMAP_I2C_BUFSTAT_REG);
> +				else    /* read RXSTAT on RDR interrupt */
> +					num_bytes = (omap_i2c_read_reg(dev,
> +							OMAP_I2C_BUFSTAT_REG)
> +							>> 8) & 0x3F;
>  			}
>  			while (num_bytes) {
>  				num_bytes--;
> @@ -731,9 +732,10 @@ omap_i2c_isr(int this_irq, void *dev_id)
>  			if (dev->fifo_size) {
>  				if (stat & OMAP_I2C_STAT_XRDY)
>  					num_bytes = dev->fifo_size;
> -				else
> -					num_bytes = omap_i2c_read_reg(dev,
> -							OMAP_I2C_BUFSTAT_REG);
> +				else    /* read TXSTAT on XDR interrupt */
> +					num_bytes = omap_i2c_read_reg(dev,
> +							OMAP_I2C_BUFSTAT_REG)
> +							& 0x3F;
>  			}
>  			while (num_bytes) {
>  				num_bytes--;
> -- 
> 1.5.6.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

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

end of thread, other threads:[~2009-07-30  0:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-21 15:14 [PATCH 1/3] [OMAP:I2C]Bug in reading the RXSTAT/TXSTAT values from the I2C_BUFFSTAT register Sonasath, Moiz
2009-07-30  0:07 ` Ben Dooks

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).