From: Alan Ott Date: Wed, 29 Nov 2017 03:25:23 +0000 (-0500) Subject: i2c: at91_i2c: Wait for TXRDY after sending the first byte X-Git-Tag: v2018.01-rc2~56^2~2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0afbb0e1c01382f4bcd728ecbd4e49a928dbbccb;p=u-boot 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 Reviewed-by: Heiko Schocher --- 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], ®->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);