aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndriy Gapon <avg@FreeBSD.org>2021-12-19 09:26:40 +0000
committerAndriy Gapon <avg@FreeBSD.org>2021-12-19 10:05:52 +0000
commite5268c3d435e0a0f0fef64e6213504dd189272f6 (patch)
tree90035c9bae210faff66deeeb5217fd84e44c5b4f
parent9a8cf950b259f6833c7562ce941b0cfeae6687e5 (diff)
twsi: fix handling of consecuitve write messages in transaction
Make sure to reset 'message_done' flag when jumping from a message to the next one within the same interrupt handler call. This happens only when a write with no-stop flag message is followed by a write with no-start flag message. Without this fix the second message would be prematurely "completed" without waiting for an ACK (or NACK) for its first byte and without sending subsequent bytes (if any). Fixes: ff1e8581 twsi: support more message combinations in transfers MFC after: 4 days
-rw-r--r--sys/dev/iicbus/twsi/twsi.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/dev/iicbus/twsi/twsi.c b/sys/dev/iicbus/twsi/twsi.c
index ab0bb3f26961..740c7e14a31f 100644
--- a/sys/dev/iicbus/twsi/twsi.c
+++ b/sys/dev/iicbus/twsi/twsi.c
@@ -563,7 +563,6 @@ twsi_intr(void *arg)
bool send_start;
sc = arg;
- message_done = false;
send_start = false;
mtx_lock(&sc->mutex);
@@ -582,6 +581,8 @@ twsi_intr(void *arg)
}
restart:
+ message_done = false;
+
switch (status) {
case TWSI_STATUS_START:
case TWSI_STATUS_RPTD_START: