From: Eero Nurkkala Date: Tue, 25 Nov 2008 11:03:46 +0000 (+0200) Subject: i2c: i2c-omap: Fix BUFSTAT_REG reading X-Git-Tag: v2.6.28-omap1~8 X-Git-Url: http://www.pilppa.org/gitweb/gitweb.cgi?p=linux-2.6-omap-h63xx.git;a=commitdiff_plain;h=3487568e15df6e133f5f55779dec614dbeb68a99 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. Signed-off-by: Eero Nurkkala Signed-off-by: Tony Lindgren --- diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 96f3bedb279..71b37ed4b72 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--;