This is an automated email from Gerrit. Eric Katzfey ([email protected]) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/3710
-- gerrit commit c4ee031b5c80f6b2df4fc02d214ce5d07ef8a6ad Author: Eric Katzfey <[email protected]> Date: Thu Aug 18 16:54:11 2016 -0700 arm_adi_v5: Add ability to ignore the CSYSPWRUPACK bit The CTRL/STAT register in the ARM DAP DP has a debug power up ack bit and a system power up ack bit. Some devices do not set the system power up ack bit until sometime later. To avoid having the initial target examination fail due to this or to have a sticky bit error report claim power failure due to this a user can now specify that this bit should be ignored. Change-Id: I2451234bbe904984e29562ef6f616cc6d6f60732 Signed-off-by: Eric Katzfey <[email protected]> diff --git a/doc/openocd.texi b/doc/openocd.texi index 8146654..572adfd 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -3726,6 +3726,11 @@ a TAP doesn't conform to the JTAG specification. to verify that instruction scans work correctly. Such scans are not used by OpenOCD except to verify that there seems to be no problems with JTAG scan chain operations. +@item @code{-ignore-syspwrupack} +@*Specify this to ignore the CSYSPWRUPACK bit in the ARM DAP DP CTRL/STAT +register during initial examination and when checking the sticky error bit. +This bit is normally checked after setting the CSYSPWRUPREQ bit, but some +devices do not set the ack bit until sometime later. @end itemize @end deffn diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h index 7702d6c..0499306 100644 --- a/src/jtag/jtag.h +++ b/src/jtag/jtag.h @@ -155,6 +155,10 @@ struct jtag_tap { struct jtag_tap *next_tap; /* dap instance if some null if no instance , initialized to 0 by calloc*/ struct adiv5_dap *dap; + /** Flag saying whether to ignore the syspwrupack flag in DAP. Some devices + * do not set this bit until later in the bringup sequence */ + bool ignore_syspwrupack; + /* private pointer to support none-jtag specific functions */ void *priv; }; diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index bc6bbf2..58aec2f 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -452,6 +452,7 @@ static int jim_newtap_expected_id(Jim_Nvp *n, Jim_GetOptInfo *goi, #define NTAP_OPT_DISABLED 4 #define NTAP_OPT_EXPECTED_ID 5 #define NTAP_OPT_VERSION 6 +#define NTAP_OPT_SYSPWRUPACK 7 static int jim_newtap_ir_param(Jim_Nvp *n, Jim_GetOptInfo *goi, struct jtag_tap *pTap) @@ -514,6 +515,7 @@ static int jim_newtap_cmd(Jim_GetOptInfo *goi) { .name = "-disable", .value = NTAP_OPT_DISABLED }, { .name = "-expected-id", .value = NTAP_OPT_EXPECTED_ID }, { .name = "-ignore-version", .value = NTAP_OPT_VERSION }, + { .name = "-ignore-syspwrupack", .value = NTAP_OPT_SYSPWRUPACK }, { .name = NULL, .value = -1 }, }; @@ -599,6 +601,9 @@ static int jim_newtap_cmd(Jim_GetOptInfo *goi) case NTAP_OPT_VERSION: pTap->ignore_version = true; break; + case NTAP_OPT_SYSPWRUPACK: + pTap->ignore_syspwrupack = true; + break; } /* switch (n->value) */ } /* while (goi->argc) */ @@ -864,6 +869,7 @@ static const struct command_registration jtag_subcommand_handlers[] = { "['-enable'|'-disable'] " "['-expected_id' number] " "['-ignore-version'] " + "['-ignore-syspwrupack'] " "['-ircapture' number] " "['-mask' number] ", }, diff --git a/src/target/adi_v5_jtag.c b/src/target/adi_v5_jtag.c index 2717c9e..fa63ae4 100644 --- a/src/target/adi_v5_jtag.c +++ b/src/target/adi_v5_jtag.c @@ -553,7 +553,7 @@ static int jtagdp_overrun_check(struct adiv5_dap *dap) static int jtagdp_transaction_endcheck(struct adiv5_dap *dap) { int retval; - uint32_t ctrlstat; + uint32_t ctrlstat, pwrmask; /* too expensive to call keep_alive() here */ @@ -571,8 +571,10 @@ static int jtagdp_transaction_endcheck(struct adiv5_dap *dap) if (ctrlstat & SSTICKYERR) { LOG_DEBUG("jtag-dp: CTRL/STAT 0x%" PRIx32, ctrlstat); /* Check power to debug regions */ - if ((ctrlstat & (CDBGPWRUPREQ | CDBGPWRUPACK | CSYSPWRUPREQ | CSYSPWRUPACK)) != - (CDBGPWRUPREQ | CDBGPWRUPACK | CSYSPWRUPREQ | CSYSPWRUPACK)) { + pwrmask = CDBGPWRUPREQ | CDBGPWRUPACK | CSYSPWRUPREQ; + if (!dap->tap->ignore_syspwrupack) + pwrmask |= CSYSPWRUPACK; + if ((ctrlstat & pwrmask) != pwrmask) { LOG_ERROR("Debug regions are unpowered, an unexpected reset might have happened"); retval = ERROR_JTAG_DEVICE_ERROR; goto done; diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index f58afdc..b803c22 100644 --- a/src/target/arm_adi_v5.c +++ b/src/target/arm_adi_v5.c @@ -640,12 +640,14 @@ int dap_dp_init(struct adiv5_dap *dap) if (retval != ERROR_OK) continue; - LOG_DEBUG("DAP: wait CSYSPWRUPACK"); - retval = dap_dp_poll_register(dap, DP_CTRL_STAT, - CSYSPWRUPACK, CSYSPWRUPACK, - DAP_POWER_DOMAIN_TIMEOUT); - if (retval != ERROR_OK) - continue; + if (!dap->tap->ignore_syspwrupack) { + LOG_DEBUG("DAP: wait CSYSPWRUPACK"); + retval = dap_dp_poll_register(dap, DP_CTRL_STAT, + CSYSPWRUPACK, CSYSPWRUPACK, + DAP_POWER_DOMAIN_TIMEOUT); + if (retval != ERROR_OK) + continue; + } retval = dap_queue_dp_read(dap, DP_CTRL_STAT, NULL); if (retval != ERROR_OK) -- ------------------------------------------------------------------------------ _______________________________________________ OpenOCD-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openocd-devel
