This is an automated email from Gerrit. "Tomas Vanek <[email protected]>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/6698
-- gerrit commit 23e5d70629519aba6ddc6b185ca7a39f537c4fdb Author: Tomas Vanek <[email protected]> Date: Fri Nov 12 09:49:01 2021 +0100 drivers/ftdi: add support for SWD multidrop According to ARM IHI0031C+ chapter 2.3.11 "TARGETSEL, Target Selection register" multidrop capable DPv2 must not drive SWDIO line during the response phase of a write to TARGETSEL register. Ignore ack received after DP_TARGETSEL write to prevent false error. Inspired by Graham Sanderson's http://openocd.zylin.com/4935 Change-Id: I04fd77cde3244de250743d8c8bfb93ed26379385 Signed-off-by: Tomas Vanek <[email protected]> diff --git a/src/jtag/drivers/ftdi.c b/src/jtag/drivers/ftdi.c index 82298c23d..0c88458a1 100644 --- a/src/jtag/drivers/ftdi.c +++ b/src/jtag/drivers/ftdi.c @@ -1121,7 +1121,12 @@ static int ftdi_swd_run_queue(void) for (size_t i = 0; i < swd_cmd_queue_length; i++) { int ack = buf_get_u32(swd_cmd_queue[i].trn_ack_data_parity_trn, 1, 3); - LOG_DEBUG_IO("%s %s %s reg %X = %08"PRIx32, + uint8_t base_cmd = swd_cmd_queue[i].cmd & (SWD_CMD_APNDP|SWD_CMD_RNW|SWD_CMD_A32); + /* Devices do not reply to DP_TARGETSEL write cmd, ignore received ack */ + bool ignore_ack = base_cmd == swd_cmd(false, false, DP_TARGETSEL); + + LOG_DEBUG_IO("%s%s %s %s reg %X = %08"PRIx32, + ignore_ack ? "ack ignored " : "", ack == SWD_ACK_OK ? "OK" : ack == SWD_ACK_WAIT ? "WAIT" : ack == SWD_ACK_FAULT ? "FAULT" : "JUNK", swd_cmd_queue[i].cmd & SWD_CMD_APNDP ? "AP" : "DP", swd_cmd_queue[i].cmd & SWD_CMD_RNW ? "read" : "write", @@ -1129,7 +1134,7 @@ static int ftdi_swd_run_queue(void) buf_get_u32(swd_cmd_queue[i].trn_ack_data_parity_trn, 1 + 3 + (swd_cmd_queue[i].cmd & SWD_CMD_RNW ? 0 : 1), 32)); - if (ack != SWD_ACK_OK) { + if (ack != SWD_ACK_OK && !ignore_ack) { queued_retval = ack == SWD_ACK_WAIT ? ERROR_WAIT : ERROR_FAIL; goto skip; --
