Re: [PATCH v10 3/4] drivers/i2c/busses/i2c-at91.c: add new driver

From: Nikolaus Voss
Date: Thu Apr 26 2012 - 07:01:27 EST


Hi Carsten,

On Wed, 25 Apr 2012, Carsten Behling wrote:
I cannot find the fix for the RXRDY overrun bug in this patch:

The fix refers to the bug when RXRDY flag was masked out by TXCOMP,
reported by Hubert. I hope this is fixed with v10.

[...]
here you only report the status flags after a complete transfer, but an overrun can happen after every byte. After reading the status register after an overrun for the next byte this info will be lost !

Right, I didn't consider this. Would you mind to test if the attached patch on top of v10 fixes your problem?

Thanks,
Niko

P.S. Are you using a RM9200? Seems that this SOC has some problems...

diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index 97f4365..df0f6ed 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -186,9 +186,11 @@ static irqreturn_t atmel_twi_interrupt(int irq, void *dev_id)
else if (irqstatus & AT91_TWI_TXRDY)
at91_twi_write_next_byte(dev);

+ /* catch error flags */
+ dev->transfer_status |= status;
+
if (irqstatus & AT91_TWI_TXCOMP) {
at91_disable_twi_interrupts(dev);
- dev->transfer_status = status;
complete(&dev->cmd_complete);
}

@@ -203,6 +205,7 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev)
(dev->msg->flags & I2C_M_RD) ? "read" : "write", dev->buf_len);

INIT_COMPLETION(dev->cmd_complete);
+ dev->transfer_status = 0;
if (dev->msg->flags & I2C_M_RD) {
unsigned start_flags = AT91_TWI_START;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/