Skip to contentSkip to conversation

i2c: i2c-omap: Fix BUFSTAT_REG reading

PATCH In review [email protected] 2 participants 2 messages Nov 11, 2008

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: i2c-omap: Fix BUFSTAT_REG reading

From: Eero Nurkkala <[email protected]>

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.

---
 drivers/i2c/busses/i2c-omap.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-omap.c +3 -2
index a999606..f15668d 100644
@@ -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--;
Signature · 1 line
1.6.0
#1 lore raw

----- Original Message ----- From: <[email protected]>
To: <[email protected]>
Cc: "Eero Nurkkala" <[email protected]>
Sent: Tuesday, November 11, 2008 12:21 PM
Subject: [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading

Quoted 17 lines

From: Eero Nurkkala <[email protected]>

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.

---
drivers/i2c/busses/i2c-omap.c | 5 +++--

1 files changed, 3 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-omap.c +0 -0
index a999606..f15668d 100644

drivers/i2c/busses/i2c-omap.c omap_i2c_isr(int this_irq, void *dev_id) · line 627

Quoted 9 lines
drivers/i2c/busses/i2c-omap.c +3 -2
@@ -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;
 }

I believe "And"ing by 0x3F will apply to transmit also.

Quoted 10 lines
drivers/i2c/busses/i2c-omap.c +0 -0
 while (num_bytes) {
 num_bytes--;
Signature · 6 lines
1.6.0

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html