aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Fertser <fercerpav@gmail.com>2014-07-19 16:48:09 +0400
committerAndreas Fritiofson <andreas.fritiofson@gmail.com>2014-08-02 13:53:59 +0000
commit66e20117e8529bb0f37cf81302f1afebbe71d4b5 (patch)
tree186033a384eac6219ed4713a73070cf996b09b97
parent67332532194b16b99f0535a41b4179ca5df349b0 (diff)
downloadriscv-openocd-66e20117e8529bb0f37cf81302f1afebbe71d4b5.zip
riscv-openocd-66e20117e8529bb0f37cf81302f1afebbe71d4b5.tar.gz
riscv-openocd-66e20117e8529bb0f37cf81302f1afebbe71d4b5.tar.bz2
drivers/jlink: fix SWD speed config, and set it before sending anything
During the initialisation a driver might need to communicate with the target (e.g. sending jtag2swd sequence), so when doing so it should honour the user-specified speed. Change-Id: If84fea6057fda9edcf2c0a653edfbab2500e3cdd [andrew.smirnov@gmail.com: fix khz/hz confusion] Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2224 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
-rw-r--r--src/jtag/drivers/jlink.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/jtag/drivers/jlink.c b/src/jtag/drivers/jlink.c
index 871bf24..9d25eb4 100644
--- a/src/jtag/drivers/jlink.c
+++ b/src/jtag/drivers/jlink.c
@@ -559,6 +559,8 @@ static int jlink_init(void)
jtag_sleep(3000);
jlink_tap_init();
+ jlink_speed(jtag_get_speed_khz());
+
if (!swd_mode) {
/* v5/6 jlink seems to have an issue if the first tap move
* is not divisible by 8, so we send a TLR on first power up */
@@ -1343,7 +1345,7 @@ static void jlink_swd_read_reg(struct adiv5_dap *dap, uint8_t cmd, uint32_t *val
static int_least32_t jlink_swd_frequency(struct adiv5_dap *dap, int_least32_t hz)
{
if (hz > 0)
- jlink_speed(hz);
+ jlink_speed(hz / 1000);
return hz;
}