From 29983fd98dcc9a8e3d89b086537345b72b9fc1a3 Mon Sep 17 00:00:00 2001 From: mrv96 Date: Fri, 7 Oct 2022 14:50:03 +0200 Subject: [PATCH 1/2] (Re)Init cJTAG only after trst (not after srst) --- src/jtag/drivers/ftdi.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/jtag/drivers/ftdi.c b/src/jtag/drivers/ftdi.c index 895c55def..97f810424 100644 --- a/src/jtag/drivers/ftdi.c +++ b/src/jtag/drivers/ftdi.c @@ -676,18 +676,19 @@ static void ftdi_execute_stableclocks(struct jtag_command *cmd) static void ftdi_execute_command(struct jtag_command *cmd) { switch (cmd->type) { - case JTAG_RESET: #if BUILD_FTDI_CJTAG == 1 - cjtag_reset_online_activate(); /* put the target back into selected cJTAG mode */ -#endif + case JTAG_RESET: + if (cmd->cmd.reset->trst) + cjtag_reset_online_activate(); /* put the target (back) into selected cJTAG mode */ break; +#endif case JTAG_RUNTEST: ftdi_execute_runtest(cmd); break; case JTAG_TLR_RESET: ftdi_execute_statemove(cmd); #if BUILD_FTDI_CJTAG == 1 - cjtag_reset_online_activate(); /* put the target back into selected cJTAG mode */ + cjtag_reset_online_activate(); /* put the target (back) into selected cJTAG mode */ #endif break; case JTAG_PATHMOVE: From 0c6121d92abdf1e602f1a944873b7c9b62aa8c8c Mon Sep 17 00:00:00 2001 From: mrv96 Date: Fri, 7 Oct 2022 16:07:33 +0200 Subject: [PATCH 2/2] (Re)Init cJTAG before move JTAG to reset state Signed-off-by: mrv96 --- src/jtag/drivers/ftdi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jtag/drivers/ftdi.c b/src/jtag/drivers/ftdi.c index 97f810424..16cb0274b 100644 --- a/src/jtag/drivers/ftdi.c +++ b/src/jtag/drivers/ftdi.c @@ -686,10 +686,10 @@ static void ftdi_execute_command(struct jtag_command *cmd) ftdi_execute_runtest(cmd); break; case JTAG_TLR_RESET: - ftdi_execute_statemove(cmd); #if BUILD_FTDI_CJTAG == 1 cjtag_reset_online_activate(); /* put the target (back) into selected cJTAG mode */ #endif + ftdi_execute_statemove(cmd); break; case JTAG_PATHMOVE: ftdi_execute_pathmove(cmd);