git: a520d08538a8 - stable/13 - twsi: fix handling of consecuitve write messages in transaction
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 23 Dec 2021 08:46:22 UTC
The branch stable/13 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=a520d08538a89355c07dc55b4eb16a921340c8d0 commit a520d08538a89355c07dc55b4eb16a921340c8d0 Author: Andriy Gapon <avg@FreeBSD.org> AuthorDate: 2021-12-19 09:26:40 +0000 Commit: Andriy Gapon <avg@FreeBSD.org> CommitDate: 2021-12-23 08:45:38 +0000 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 (cherry picked from commit e5268c3d435e0a0f0fef64e6213504dd189272f6) --- sys/dev/iicbus/twsi/twsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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: