summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/flash/str9xpec.c3
-rw-r--r--src/jtag/core.c23
-rw-r--r--src/jtag/jtag.h4
-rw-r--r--src/jtag/tcl.c12
-rw-r--r--tcl/target/omap3530.cfg2
5 files changed, 41 insertions, 3 deletions
diff --git a/src/flash/str9xpec.c b/src/flash/str9xpec.c
index bca3b88f..33471e6b 100644
--- a/src/flash/str9xpec.c
+++ b/src/flash/str9xpec.c
@@ -1254,7 +1254,8 @@ static int str9xpec_handle_flash_disable_turbo_command(struct command_context_s
return ERROR_FAIL;
/* exit turbo mode via RESET */
- str9xpec_set_instr(tap, ISC_NOOP, TAP_RESET);
+ str9xpec_set_instr(tap, ISC_NOOP, TAP_IDLE);
+ jtag_add_tlr();
jtag_execute_queue();
/* restore previous scan chain */
diff --git a/src/jtag/core.c b/src/jtag/core.c
index e23cbaa2..acd84e9a 100644
--- a/src/jtag/core.c
+++ b/src/jtag/core.c
@@ -62,6 +62,7 @@ static const char *jtag_event_strings[] =
{
[JTAG_TRST_ASSERTED] = "JTAG controller reset (TLR or TRST)",
[JTAG_TAP_EVENT_ENABLE] = "TAP enabled",
+ [JTAG_TAP_EVENT_POST_RESET] = "post reset",
[JTAG_TAP_EVENT_DISABLE] = "TAP disabled",
};
@@ -339,6 +340,8 @@ void jtag_add_ir_scan_noverify(int in_count, const scan_field_t *in_fields,
void jtag_add_ir_scan(int in_num_fields, scan_field_t *in_fields, tap_state_t state)
{
+ assert(state != TAP_RESET);
+
if (jtag_verify && jtag_verify_capture_ir)
{
/* 8 x 32 bit id's is enough for all invocations */
@@ -361,6 +364,8 @@ void jtag_add_ir_scan(int in_num_fields, scan_field_t *in_fields, tap_state_t st
void jtag_add_plain_ir_scan(int in_num_fields, const scan_field_t *in_fields,
tap_state_t state)
{
+ assert(state != TAP_RESET);
+
jtag_prelude(state);
int retval = interface_jtag_add_plain_ir_scan(
@@ -439,6 +444,8 @@ void jtag_add_dr_scan_check(int in_num_fields, scan_field_t *in_fields, tap_stat
void jtag_add_dr_scan(int in_num_fields, const scan_field_t *in_fields,
tap_state_t state)
{
+ assert(state != TAP_RESET);
+
jtag_prelude(state);
int retval;
@@ -449,6 +456,8 @@ void jtag_add_dr_scan(int in_num_fields, const scan_field_t *in_fields,
void jtag_add_plain_dr_scan(int in_num_fields, const scan_field_t *in_fields,
tap_state_t state)
{
+ assert(state != TAP_RESET);
+
jtag_prelude(state);
int retval;
@@ -460,6 +469,8 @@ void jtag_add_dr_out(jtag_tap_t* tap,
int num_fields, const int* num_bits, const uint32_t* value,
tap_state_t end_state)
{
+ assert(end_state != TAP_RESET);
+
assert(end_state != TAP_INVALID);
cmd_queue_cur_state = end_state;
@@ -473,6 +484,9 @@ void jtag_add_tlr(void)
{
jtag_prelude(TAP_RESET);
jtag_set_error(interface_jtag_add_tlr());
+
+ jtag_notify_reset();
+
jtag_call_event_callbacks(JTAG_TRST_ASSERTED);
}
@@ -683,6 +697,8 @@ void jtag_add_reset(int req_tlr_or_trst, int req_srst)
LOG_DEBUG("TRST line released");
if (jtag_ntrst_delay)
jtag_add_sleep(jtag_ntrst_delay * 1000);
+
+ jtag_notify_reset();
}
}
}
@@ -851,7 +867,8 @@ static int jtag_examine_chain_execute(uint8_t *idcode_buffer, unsigned num_idcod
for (unsigned i = 0; i < JTAG_MAX_CHAIN_SIZE; i++)
buf_set_u32(idcode_buffer, i * 32, 32, 0x000000FF);
- jtag_add_plain_dr_scan(1, &field, TAP_RESET);
+ jtag_add_plain_dr_scan(1, &field, TAP_DRPAUSE);
+ jtag_add_tlr();
return jtag_execute_queue();
}
@@ -1065,7 +1082,9 @@ int jtag_validate_chain(void)
field.in_value = ir_test;
- jtag_add_plain_ir_scan(1, &field, TAP_RESET);
+ jtag_add_plain_ir_scan(1, &field, TAP_IRPAUSE);
+ jtag_add_tlr();
+
int retval;
retval = jtag_execute_queue();
if (retval != ERROR_OK)
diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h
index 3e3686b8..b7bfd4cc 100644
--- a/src/jtag/jtag.h
+++ b/src/jtag/jtag.h
@@ -208,6 +208,7 @@ enum jtag_event {
JTAG_TRST_ASSERTED,
JTAG_TAP_EVENT_ENABLE,
JTAG_TAP_EVENT_DISABLE,
+ JTAG_TAP_EVENT_POST_RESET,
};
struct jtag_tap_event_action_s
@@ -635,6 +636,9 @@ extern void jtag_execute_queue_noclear(void);
/// @returns the number of times the scan queue has been flushed
int jtag_get_flush_queue_count(void);
+/// Notify all TAP's about a TLR reset
+void jtag_notify_reset(void);
+
/* can be implemented by hw + sw */
extern int jtag_power_dropout(int* dropout);
diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c
index f81b6829..e6928a2b 100644
--- a/src/jtag/tcl.c
+++ b/src/jtag/tcl.c
@@ -41,6 +41,7 @@
#endif
static const Jim_Nvp nvp_jtag_tap_event[] = {
+ { .value = JTAG_TAP_EVENT_POST_RESET, .name = "post-reset" },
{ .value = JTAG_TAP_EVENT_ENABLE, .name = "tap-enable" },
{ .value = JTAG_TAP_EVENT_DISABLE, .name = "tap-disable" },
@@ -583,6 +584,17 @@ static int jim_jtag_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
return JIM_ERR;
}
+
+void jtag_notify_reset(void)
+{
+ jtag_tap_t *tap;
+ for (tap = jtag_all_taps(); tap; tap = tap->next_tap)
+ {
+ jtag_tap_handle_event(tap, JTAG_TAP_EVENT_POST_RESET);
+ }
+}
+
+
int jtag_register_commands(struct command_context_s *cmd_ctx)
{
register_jim(cmd_ctx, "jtag", jim_jtag_command, "perform jtag tap actions");
diff --git a/tcl/target/omap3530.cfg b/tcl/target/omap3530.cfg
index 22328a21..50a3f473 100644
--- a/tcl/target/omap3530.cfg
+++ b/tcl/target/omap3530.cfg
@@ -34,6 +34,8 @@ if { [info exists JRC_TAPID ] } {
jtag newtap $_CHIPNAME jrc -irlen 6 -ircapture 0x1 -irmask 0x3f \
-expected-id $_JRC_TAPID
+jtag configure $_CHIPNAME.jrc -event post-reset "runtest 100"
+
# GDB target: Cortex-A8, using DAP
target create omap3.cpu cortex_a8 -chain-position $_CHIPNAME.dap