public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading
@ 2008-11-25 11:03 ext-eero.nurkkala
  2009-01-08 13:37 ` Tony Lindgren
  0 siblings, 1 reply; 16+ messages in thread
From: ext-eero.nurkkala @ 2008-11-25 11:03 UTC (permalink / raw)
  To: linux-omap; +Cc: Eero Nurkkala

From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>

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 <ext-eero.nurkkala@nokia.com>
---
 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 96f3bed..71b37ed 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--;
-- 
1.6.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread
* [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading
@ 2008-11-25 11:02 ext-eero.nurkkala
  0 siblings, 0 replies; 16+ messages in thread
From: ext-eero.nurkkala @ 2008-11-25 11:02 UTC (permalink / raw)
  To: linux-omap; +Cc: Eero Nurkkala

From: Eero Nurkkala <eenurkka@lahna.nmp.nokia.com>

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 <eenurkka@lahna.nmp.nokia.com>
---
 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 96f3bed..71b37ed 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--;
-- 
1.6.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread
* [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading
@ 2008-11-25  6:56 ext-eero.nurkkala
  2008-11-25  7:27 ` David Brownell
  0 siblings, 1 reply; 16+ messages in thread
From: ext-eero.nurkkala @ 2008-11-25  6:56 UTC (permalink / raw)
  To: linux-omap; +Cc: Eero Nurkkala

From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>

The amount of bytes to receive is read from wrong
place with omap 2430 and omap 3430. It is the 6 bits
starting from the bit 8 from BUFSTAT_REG that indicate
this amount. Not the 8 LSB:s. Only 6 LSB:s are used
for the TX buffer. Moreover, only the 6 LSB:s are
relevant for XDR.

Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
---
 drivers/i2c/busses/i2c-omap.c |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 96f3bed..630702c 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -672,11 +672,19 @@ omap_i2c_isr(int this_irq, void *dev_id)
 		if (stat & (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR)) {
 			u8 num_bytes = 1;
 			if (dev->fifo_size) {
-				if (stat & OMAP_I2C_STAT_RRDY)
+				if (stat & OMAP_I2C_STAT_RRDY) {
 					num_bytes = dev->fifo_size;
-				else
-					num_bytes = omap_i2c_read_reg(dev,
+				} else {
+					if (dev->rev >= OMAP_I2C_REV_ON_2430)
+						num_bytes =
+							(omap_i2c_read_reg(dev,
+							 OMAP_I2C_BUFSTAT_REG)
+							 >> 8) & 0x3F;
+					else
+						num_bytes =
+							omap_i2c_read_reg(dev,
 							OMAP_I2C_BUFSTAT_REG);
+				}
 			}
 			while (num_bytes) {
 				num_bytes--;
@@ -711,11 +719,16 @@ omap_i2c_isr(int this_irq, void *dev_id)
 		if (stat & (OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR)) {
 			u8 num_bytes = 1;
 			if (dev->fifo_size) {
-				if (stat & OMAP_I2C_STAT_XRDY)
+				if (stat & OMAP_I2C_STAT_XRDY) {
 					num_bytes = dev->fifo_size;
-				else
-					num_bytes = omap_i2c_read_reg(dev,
+				} else {
+					num_bytes =
+						omap_i2c_read_reg(dev,
 							OMAP_I2C_BUFSTAT_REG);
+
+					if (dev->rev >= OMAP_I2C_REV_ON_2430)
+						num_bytes &= 0x3F;
+				}
 			}
 			while (num_bytes) {
 				num_bytes--;
-- 
1.6.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread
* [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading
@ 2008-11-14  8:41 ext-eero.nurkkala
  2008-11-14 19:16 ` David Brownell
  0 siblings, 1 reply; 16+ messages in thread
From: ext-eero.nurkkala @ 2008-11-14  8:41 UTC (permalink / raw)
  To: linux-omap; +Cc: Eero Nurkkala

From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>

The amount of bytes to receive is read from wrong
place. It is the 6 bits starting from the bit 8 from
BUFSTAT_REG that indicate this amount. Not the 8 LSB:s.
Only 6 LSB:s are used for the TX buffer. Also, with
omap 3430, only the 6 LSB:s are relevant for XDR.

Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
---
 drivers/i2c/busses/i2c-omap.c |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index a999606..e708ebd 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -618,11 +618,19 @@ omap_i2c_isr(int this_irq, void *dev_id)
 		if (stat & (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR)) {
 			u8 num_bytes = 1;
 			if (dev->fifo_size) {
-				if (stat & OMAP_I2C_STAT_RRDY)
+				if (stat & OMAP_I2C_STAT_RRDY) {
 					num_bytes = dev->fifo_size;
-				else
-					num_bytes = omap_i2c_read_reg(dev,
+				} else {
+					if (cpu_is_omap34xx())
+						num_bytes =
+							(omap_i2c_read_reg(dev,
+							 OMAP_I2C_BUFSTAT_REG)
+							 >> 8) & 0x3F;
+					else
+						num_bytes =
+							omap_i2c_read_reg(dev,
 							OMAP_I2C_BUFSTAT_REG);
+				}
 			}
 			while (num_bytes) {
 				num_bytes--;
@@ -657,11 +665,16 @@ omap_i2c_isr(int this_irq, void *dev_id)
 		if (stat & (OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR)) {
 			u8 num_bytes = 1;
 			if (dev->fifo_size) {
-				if (stat & OMAP_I2C_STAT_XRDY)
+				if (stat & OMAP_I2C_STAT_XRDY) {
 					num_bytes = dev->fifo_size;
-				else
-					num_bytes = omap_i2c_read_reg(dev,
+				} else {
+					num_bytes =
+						omap_i2c_read_reg(dev,
 							OMAP_I2C_BUFSTAT_REG);
+
+					if (cpu_is_omap34xx())
+						num_bytes &= 0x3F;
+				}
 			}
 			while (num_bytes) {
 				num_bytes--;
-- 
1.6.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread
* [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading
@ 2008-11-11  6:51 ext-eero.nurkkala
  2008-11-11  9:57 ` shekhar, chandra
  0 siblings, 1 reply; 16+ messages in thread
From: ext-eero.nurkkala @ 2008-11-11  6:51 UTC (permalink / raw)
  To: linux-omap; +Cc: Eero Nurkkala

From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>

The amount of bytes to receive is read from wrong
place. It is the 6 bits starting from the bit 8 from
BUFSTAT_REG that indicate this amount. Not the 8 LSB:s.
6 LSB:s are used for the TX buffer.

Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
---
 drivers/i2c/busses/i2c-omap.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index a999606..f15668d 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -621,8 +621,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--;
-- 
1.6.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread
* [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading
@ 2008-11-10 10:46 ext-eero.nurkkala
  2008-11-10 12:27 ` Felipe Balbi
  0 siblings, 1 reply; 16+ messages in thread
From: ext-eero.nurkkala @ 2008-11-10 10:46 UTC (permalink / raw)
  To: linux-omap; +Cc: Eero Nurkkala

From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>


Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
---
 drivers/i2c/busses/i2c-omap.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index f4d1edc..9ae3ad3 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -642,8 +642,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--;
-- 
1.5.2


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

end of thread, other threads:[~2009-01-08 13:37 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-25 11:03 [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading ext-eero.nurkkala
2009-01-08 13:37 ` Tony Lindgren
  -- strict thread matches above, loose matches on Subject: below --
2008-11-25 11:02 ext-eero.nurkkala
2008-11-25  6:56 ext-eero.nurkkala
2008-11-25  7:27 ` David Brownell
2008-11-25  9:19   ` Eero Nurkkala
2008-11-25 10:01     ` David Brownell
2008-11-14  8:41 ext-eero.nurkkala
2008-11-14 19:16 ` David Brownell
2008-11-19 12:12   ` Eero Nurkkala
2008-11-19 17:34     ` David Brownell
2008-11-21 22:03       ` Tony Lindgren
2008-11-11  6:51 ext-eero.nurkkala
2008-11-11  9:57 ` shekhar, chandra
2008-11-10 10:46 ext-eero.nurkkala
2008-11-10 12:27 ` Felipe Balbi

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