aboutsummaryrefslogtreecommitdiff
path: root/src/jtag/drivers/ftdi.c
diff options
context:
space:
mode:
authorPaul Fertser <fercerpav@gmail.com>2014-11-02 15:16:13 +0300
committerSpencer Oliver <spen@spen-soft.co.uk>2015-01-09 08:36:52 +0000
commit9f6d4d1302e778a4f57033f3d86c757718f2ca9f (patch)
treeadcf9dbea6778677d1a5db94054a788596bae9cb /src/jtag/drivers/ftdi.c
parentc120fb6d893a89d9805d0b4d6083e47810143f2d (diff)
downloadriscv-openocd-9f6d4d1302e778a4f57033f3d86c757718f2ca9f.zip
riscv-openocd-9f6d4d1302e778a4f57033f3d86c757718f2ca9f.tar.gz
riscv-openocd-9f6d4d1302e778a4f57033f3d86c757718f2ca9f.tar.bz2
swd: handle various failure conditions
When communication with target fails for whatever reason, it makes sense to do JTAG-to-SWD (in case the target got power-cycled or the DAP method was reset anyhow), SWD line reset sequence (part of JTAG-to-SWD already) and the mandatory IDCODE read. Schedule that to be performed on the next poll. Fix the return values for ftdi and jlink drivers to be consistent with OpenOCD error codes and remove ad-hoc calls to perform DAP method switching (as it's now done from the upper layer automatically). Change-Id: Ie18797d4ce7ac43d8249f8f81f1064a2424e02be Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2371 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-by: Mateusz Manowiecki <segmentation@fault.pl>
Diffstat (limited to 'src/jtag/drivers/ftdi.c')
-rw-r--r--src/jtag/drivers/ftdi.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/jtag/drivers/ftdi.c b/src/jtag/drivers/ftdi.c
index 6406406..c031fd3 100644
--- a/src/jtag/drivers/ftdi.c
+++ b/src/jtag/drivers/ftdi.c
@@ -655,11 +655,6 @@ static int ftdi_initialize(void)
freq = mpsse_set_frequency(mpsse_ctx, jtag_get_speed_khz() * 1000);
- if (swd_mode)
- ftdi_swd_switch_seq(NULL, JTAG_TO_SWD);
- else
- ftdi_swd_switch_seq(NULL, SWD_TO_JTAG);
-
return mpsse_flush(mpsse_ctx);
}
@@ -981,7 +976,7 @@ static int ftdi_swd_run_queue(struct adiv5_dap *dap)
1 + 3 + (swd_cmd_queue[i].cmd & SWD_CMD_RnW ? 0 : 1), 32));
if (ack != SWD_ACK_OK) {
- queued_retval = ack;
+ queued_retval = ack == SWD_ACK_WAIT ? ERROR_WAIT : ERROR_FAIL;
goto skip;
} else if (swd_cmd_queue[i].cmd & SWD_CMD_RnW) {