X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Ftarget%2Fadi_v5_jtag.c;h=c7dc4f7c988c4059bf9c81845b1ac559f397c8df;hb=78a44055c50f4ea10ebb14714c4b6563cd64f71b;hp=201ed90aad336a13929d9039466c8e516bfc8fd0;hpb=5373085b4d7ab600d0325634f3adc846f92169af;p=openocd.git diff --git a/src/target/adi_v5_jtag.c b/src/target/adi_v5_jtag.c index 201ed90aad..c7dc4f7c98 100644 --- a/src/target/adi_v5_jtag.c +++ b/src/target/adi_v5_jtag.c @@ -21,9 +21,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * along with this program. If not, see . ***************************************************************************/ /** @@ -359,7 +357,7 @@ static int jtagdp_overrun_check(struct adiv5_dap *dap) int retval; struct dap_cmd *el, *tmp, *prev = NULL; int found_wait = 0; - uint64_t time_now; + int64_t time_now; LIST_HEAD(replay_list); /* make sure all queued transactions are complete */ @@ -450,7 +448,12 @@ static int jtagdp_overrun_check(struct adiv5_dap *dap) /* timeout happened */ if (tmp->ack != JTAG_ACK_OK_FAULT) { LOG_ERROR("Timeout during WAIT recovery"); + dap->select = DP_SELECT_INVALID; jtag_ap_q_abort(dap, NULL); + /* clear the sticky overrun condition */ + adi_jtag_scan_inout_check_u32(dap, JTAG_DP_DPACC, + DP_CTRL_STAT, DPAP_WRITE, + dap->dp_ctrl_stat | SSTICKYORUN, NULL, 0); retval = ERROR_JTAG_DEVICE_ERROR; } } @@ -527,8 +530,14 @@ static int jtagdp_overrun_check(struct adiv5_dap *dap) if (retval == ERROR_OK) { if (el->ack != JTAG_ACK_OK_FAULT) { LOG_ERROR("Timeout during WAIT recovery"); + dap->select = DP_SELECT_INVALID; jtag_ap_q_abort(dap, NULL); + /* clear the sticky overrun condition */ + adi_jtag_scan_inout_check_u32(dap, JTAG_DP_DPACC, + DP_CTRL_STAT, DPAP_WRITE, + dap->dp_ctrl_stat | SSTICKYORUN, NULL, 0); retval = ERROR_JTAG_DEVICE_ERROR; + break; } } else break; @@ -565,8 +574,6 @@ static int jtagdp_transaction_endcheck(struct adiv5_dap *dap) if ((ctrlstat & (CDBGPWRUPREQ | CDBGPWRUPACK | CSYSPWRUPREQ | CSYSPWRUPACK)) != (CDBGPWRUPREQ | CDBGPWRUPACK | CSYSPWRUPREQ | CSYSPWRUPACK)) { LOG_ERROR("Debug regions are unpowered, an unexpected reset might have happened"); - retval = ERROR_JTAG_DEVICE_ERROR; - goto done; } if (ctrlstat & SSTICKYERR) @@ -581,10 +588,7 @@ static int jtagdp_transaction_endcheck(struct adiv5_dap *dap) if (retval != ERROR_OK) goto done; - if (ctrlstat & SSTICKYERR) { - retval = ERROR_JTAG_DEVICE_ERROR; - goto done; - } + retval = ERROR_JTAG_DEVICE_ERROR; } done: