summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/target/arm_adi_v5.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c
index 039cf87e..883ec776 100644
--- a/src/target/arm_adi_v5.c
+++ b/src/target/arm_adi_v5.c
@@ -1195,9 +1195,16 @@ int ahbap_debugport_init(struct adiv5_dap *dap)
return retval;
}
- retval = dap_queue_dp_read(dap, DP_CTRL_STAT, NULL);
+// retval = dap_queue_dp_read(dap, DP_CTRL_STAT, NULL);
+// if (retval != ERROR_OK)
+// return retval;
+
+ retval = dap_queue_dp_read(dap, DP_CTRL_STAT, &ctrlstat);
if (retval != ERROR_OK)
return retval;
+ if ((retval = dap_run(dap)) != ERROR_OK)
+ return retval;
+ LOG_DEBUG("pre: ctrlstat=0x%08x", ctrlstat);
// We want to power on the core and debug, also reset them in case they were active.
// dap->dp_ctrl_stat = CDBGPWRUPREQ | CSYSPWRUPREQ | CDBGRSTREQ;
@@ -1215,29 +1222,31 @@ int ahbap_debugport_init(struct adiv5_dap *dap)
// Wait for System powerup to complete.
while (!(ctrlstat & CSYSPWRUPACK) && (cnt++ < 10))
{
- LOG_DEBUG("DAP: wait CSYSPWRUPACK");
+ LOG_DEBUG("DAP: wait CSYSPWRUPACK, cnt=%d", cnt);
retval = dap_queue_dp_read(dap, DP_CTRL_STAT, &ctrlstat);
if (retval != ERROR_OK)
return retval;
if ((retval = dap_run(dap)) != ERROR_OK)
return retval;
+ LOG_DEBUG("ctrlstat=0x%08x", ctrlstat);
}
// Wait for Debug Unit powerup to complete.
- while (!(ctrlstat & CDBGPWRUPACK) && (cnt++ < 20))
+ while (!(ctrlstat & CDBGPWRUPACK) && (cnt++ < 10))
{
- LOG_DEBUG("DAP: wait CDBGPWRUPACK");
+ LOG_DEBUG("DAP: wait CDBGPWRUPACK, cnt=%d", cnt);
retval = dap_queue_dp_read(dap, DP_CTRL_STAT, &ctrlstat);
if (retval != ERROR_OK)
return retval;
if ((retval = dap_run(dap)) != ERROR_OK)
return retval;
+ LOG_DEBUG("ctrlstat=0x%08x", ctrlstat);
}
/* // wait for debug unit reset to complete.
while (!(ctrlstat & cdbgrstack) && (cnt++ < 30))
{
- log_debug("dap: wait cdbgrstack");
+ log_debug("DAP: wait CDBGRSTACK");
retval = dap_queue_dp_read(dap, dp_ctrl_stat, &ctrlstat);
if (retval != error_ok)
return retval;
@@ -1250,7 +1259,7 @@ int ahbap_debugport_init(struct adiv5_dap *dap)
// At this point CDBGPWRUPACK|CSYSPWRUPACK|CDBGRSTACK still may not be set!
// We should not proceed, it may indicate target failure...
if (cnt>=10) {
- LOG_ERROR("CDBGPWRUPACK|CSYSPWRUPACK|CDBGRSTACK FLAGS NOT SET IN RESPONSE!");
+ LOG_ERROR("CDBGPWRUPACK|CSYSPWRUPACK|CDBGRSTACK FLAGS NOT SET IN RESPONSE!, cnt=%d", cnt);
return(ERROR_FAIL);
}