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: Alan Ott <alan@softiron.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
} else {
writel(msg->buf[0], ®->thr);
+ ret = at91_wait_for_xfer(bus, TWI_SR_TXRDY);
+
for (i = 1; !ret && (i < msg->len); i++) {
writel(msg->buf[i], ®->thr);
ret = at91_wait_for_xfer(bus, TWI_SR_TXRDY);