X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Ftarget%2Fadi_v5_swd.c;h=68350424372bf6905fa38f456b47e7d23bb308c2;hb=f998a2aaf19c14b46fd7f7dd50607a0904f40bd3;hp=c23cee157d53751e0a24f59879f078b76ac83617;hpb=d2033997871f8561d1406550c12508461f63de48;p=fw%2Fopenocd diff --git a/src/target/adi_v5_swd.c b/src/target/adi_v5_swd.c index c23cee157..683504243 100644 --- a/src/target/adi_v5_swd.c +++ b/src/target/adi_v5_swd.c @@ -315,7 +315,12 @@ static int swd_connect_single(struct adiv5_dap *dap) int64_t timeout = timeval_ms() + 500; do { - swd_send_sequence(dap, JTAG_TO_SWD); + if (dap->switch_through_dormant) { + swd_send_sequence(dap, JTAG_TO_DORMANT); + swd_send_sequence(dap, DORMANT_TO_SWD); + } else { + swd_send_sequence(dap, JTAG_TO_SWD); + } /* Clear link state, including the SELECT cache. */ dap->do_reconnect = false; @@ -330,6 +335,7 @@ static int swd_connect_single(struct adiv5_dap *dap) alive_sleep(1); + dap->switch_through_dormant = !dap->switch_through_dormant; } while (timeval_ms() < timeout); if (retval != ERROR_OK) { @@ -568,7 +574,12 @@ static void swd_quit(struct adiv5_dap *dap) * swd->switch_seq(DORMANT_TO_JTAG); */ } else { - swd->switch_seq(SWD_TO_JTAG); + if (dap->switch_through_dormant) { + swd->switch_seq(SWD_TO_DORMANT); + swd->switch_seq(DORMANT_TO_JTAG); + } else { + swd->switch_seq(SWD_TO_JTAG); + } } /* flush the queue to shift out the sequence before exit */