summaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-at91-master.c
diff options
context:
space:
mode:
authorMoritz Fischer <mdf@kernel.org>2019-09-04 04:35:07 +0200
committerMoritz Fischer <mdf@kernel.org>2019-09-04 04:35:07 +0200
commitaf9ca4b0bd0502bb134f18d394a613be371d2352 (patch)
tree37b1159d4456e223981dddde4795f2061c83d14c /drivers/i2c/busses/i2c-at91-master.c
parentMerge tag 'dev_groups_all_drivers' into fpga-dfl-for-5.4 (diff)
parentMerge 5.3-rc7 into char-misc-next (diff)
downloadlinux-af9ca4b0bd0502bb134f18d394a613be371d2352.tar.xz
linux-af9ca4b0bd0502bb134f18d394a613be371d2352.zip
Merge branch 'char-misc-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc into fpga-dfl-for-5.4
Diffstat (limited to 'drivers/i2c/busses/i2c-at91-master.c')
-rw-r--r--drivers/i2c/busses/i2c-at91-master.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/i2c/busses/i2c-at91-master.c b/drivers/i2c/busses/i2c-at91-master.c
index e87232f2e708..a3fcc35ffd3b 100644
--- a/drivers/i2c/busses/i2c-at91-master.c
+++ b/drivers/i2c/busses/i2c-at91-master.c
@@ -122,9 +122,11 @@ static void at91_twi_write_next_byte(struct at91_twi_dev *dev)
writeb_relaxed(*dev->buf, dev->base + AT91_TWI_THR);
/* send stop when last byte has been written */
- if (--dev->buf_len == 0)
+ if (--dev->buf_len == 0) {
if (!dev->use_alt_cmd)
at91_twi_write(dev, AT91_TWI_CR, AT91_TWI_STOP);
+ at91_twi_write(dev, AT91_TWI_IDR, AT91_TWI_TXRDY);
+ }
dev_dbg(dev->dev, "wrote 0x%x, to go %zu\n", *dev->buf, dev->buf_len);
@@ -542,9 +544,8 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev)
} else {
at91_twi_write_next_byte(dev);
at91_twi_write(dev, AT91_TWI_IER,
- AT91_TWI_TXCOMP |
- AT91_TWI_NACK |
- AT91_TWI_TXRDY);
+ AT91_TWI_TXCOMP | AT91_TWI_NACK |
+ (dev->buf_len ? AT91_TWI_TXRDY : 0));
}
}