Commit 0afbb0e1 authored by Alan Ott's avatar Alan Ott Committed by Heiko Schocher

i2c: at91_i2c: Wait for TXRDY after sending the first byte

The driver must wait for TXRDY after each byte is pushed into
the i2c FIFO before pushing the next byte. Previously this was
not done for the first byte, causing a race condition with zeros
sometimes being sent for the next byte (which is typically the
first actual data byte).
Signed-off-by: default avatarAlan Ott <[email protected]>
Reviewed-by: default avatarHeiko Schocher <[email protected]>
parent 50a69095
......@@ -72,6 +72,8 @@ static int at91_i2c_xfer_msg(struct at91_i2c_bus *bus, struct i2c_msg *msg)
} else {
writel(msg->buf[0], &reg->thr);
ret = at91_wait_for_xfer(bus, TWI_SR_TXRDY);
for (i = 1; !ret && (i < msg->len); i++) {
writel(msg->buf[i], &reg->thr);
ret = at91_wait_for_xfer(bus, TWI_SR_TXRDY);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment