From 5292c7eae925d59d6b6c0017b6a4995d39a6e9ee Mon Sep 17 00:00:00 2001 From: Tomas Vanek Date: Thu, 24 Nov 2022 14:21:59 +0100 Subject: [PATCH] jtag/drivers/cmsis_dap: prevent conn/discon workaround before line reset The line reset SWD sequence is used quite often in SWD multidrop mode. Prevent the ugly connect/disconnect adapter firmware bug workaround to be called before each line reset. Signed-off-by: Tomas Vanek Change-Id: Id85bff075dba9077e4e501e2cdcfd64d5d9d0531 Reviewed-on: https://review.openocd.org/c/openocd/+/7381 Tested-by: jenkins Reviewed-by: Antonio Borneo --- src/jtag/drivers/cmsis_dap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/jtag/drivers/cmsis_dap.c b/src/jtag/drivers/cmsis_dap.c index d2c30cc79..0c42a7f1e 100644 --- a/src/jtag/drivers/cmsis_dap.c +++ b/src/jtag/drivers/cmsis_dap.c @@ -1158,7 +1158,9 @@ static int cmsis_dap_swd_switch_seq(enum swd_special_seq seq) unsigned int s_len; int retval; - if ((output_pins & (SWJ_PIN_SRST | SWJ_PIN_TRST)) == (SWJ_PIN_SRST | SWJ_PIN_TRST)) { + if (seq != LINE_RESET && + (output_pins & (SWJ_PIN_SRST | SWJ_PIN_TRST)) + == (SWJ_PIN_SRST | SWJ_PIN_TRST)) { /* Following workaround deasserts reset on most adapters. * Do not reconnect if a reset line is active! * Reconnecting would break connecting under reset. */