summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/arm/at91/at91_twi.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/sys/arm/at91/at91_twi.c b/sys/arm/at91/at91_twi.c
index 6442d07..b101772 100644
--- a/sys/arm/at91/at91_twi.c
+++ b/sys/arm/at91/at91_twi.c
@@ -338,7 +338,7 @@ at91_twi_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs)
err = EINVAL;
goto out;
}
- if (len == 1)
+ if (len == 1 && msgs[i].flags & IIC_M_RD)
WR4(sc, TWI_CR, TWI_CR_START | TWI_CR_STOP);
else
WR4(sc, TWI_CR, TWI_CR_START);
@@ -358,8 +358,6 @@ at91_twi_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs)
}
} else {
while (len--) {
- if (len == 0 && msgs[i].len != 1)
- WR4(sc, TWI_CR, TWI_CR_STOP);
if ((err = at91_twi_wait(sc, TWI_SR_TXRDY)))
goto out;
WR4(sc, TWI_THR, *buf++);
OpenPOWER on IntegriCloud