aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Welwarsky <matthias.welwarsky@sysgo.com>2016-07-13 11:48:48 +0200
committerAndreas Fritiofson <andreas.fritiofson@gmail.com>2016-08-09 14:36:13 +0100
commit03942f867a0de1eff13828e15b9798a1e589b169 (patch)
tree68c4f1788fa4b6081a89b5a7d7dbfeb4a172fbca
parent918de0be13b73e8e1d48726a91520b5e3589d66d (diff)
adi_v5_jtag: clear sticky overrun condition in WAIT timeout
If WAIT recovery fails (times out), an ABORT command is issued to the DAP but under some conditions the SSTICKYORUN bit in CTRL/STAT is not cleared as well, which renders the DP unusable. This happens when trying to access e.g. the ROM table of powered-down cores, on many targets. Change-Id: Id0a7ba6180069eee562871314f520f938df9718f Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com> Reviewed-on: http://openocd.zylin.com/3476 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
-rw-r--r--src/target/adi_v5_jtag.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/target/adi_v5_jtag.c b/src/target/adi_v5_jtag.c
index 36d5cad5..2717c9e3 100644
--- a/src/target/adi_v5_jtag.c
+++ b/src/target/adi_v5_jtag.c
@@ -448,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;
}
}
@@ -525,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;