Skip to contentSkip to conversation

i2c: i2c-omap: Fix BUFSTAT_REG reading

PATCH Tony Lindgren 1 participant 1 message Feb 20, 2009 2 messages not in the archive I2C subsystem host drivers

lore
Share & tools
lore
#2 lore raw
In reply to a message not in the archive
Quoted 4 lines · Tony Lindgren

Hi Ben,

Here's a fix for i2c-omap fix from Eero Nurkkala that would be nice to get queued up for mainline.

Resent, I still had the old i2c list in my aliases..

Quoted 48 lines

Regards,

Tony

From b3849f3074fe50f176e2e4d89be56854f7b02d3b Mon Sep 17 00:00:00 2001
From: Eero Nurkkala <[email protected]>
Date: Fri, 20 Feb 2009 10:46:17 -0800
Subject: [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading

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.

drivers/i2c/busses/i2c-omap.c +6 -4
index be8ee2c..0c3ed41 100644
@@ -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--;