summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAlan Ott <alan@softiron.com>2017-11-29 06:25:23 +0300
committerHeiko Schocher <hs@denx.de>2017-12-07 11:28:58 +0300
commit0afbb0e1c01382f4bcd728ecbd4e49a928dbbccb (patch)
treede853ec28e771d202d429b69049ca38c6d5e2d2e /drivers
parent50a69095cbcaa0e17aebc3ec6a502017f6fed55a (diff)
downloadu-boot-0afbb0e1c01382f4bcd728ecbd4e49a928dbbccb.tar.xz
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: Alan Ott <alan@softiron.com> Reviewed-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/at91_i2c.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/i2c/at91_i2c.c b/drivers/i2c/at91_i2c.c
index d394044f80..20d09296a1 100644
--- a/drivers/i2c/at91_i2c.c
+++ b/drivers/i2c/at91_i2c.c
@@ -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);