diff options
author | Laurent LEMELE <laurent.lemele@st.com> | 2020-02-12 22:22:54 +0100 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2020-04-05 14:12:21 +0100 |
commit | 56ff1ecddb4302ba53b6eed3581b0ca2a4e23d78 (patch) | |
tree | 173c1a8311ef1248da64316e45ed4269a1a4a78d /src | |
parent | 4ce4aa752b638d8eb39864d1ad498bde139f5233 (diff) | |
download | riscv-openocd-56ff1ecddb4302ba53b6eed3581b0ca2a4e23d78.zip riscv-openocd-56ff1ecddb4302ba53b6eed3581b0ca2a4e23d78.tar.gz riscv-openocd-56ff1ecddb4302ba53b6eed3581b0ca2a4e23d78.tar.bz2 |
stlink: fix speed setting in dap mode
stlink accepts a set of values for "adapter speed".
Fix the api khz() to return one of the allowed speed values.
Change-Id: Iac640b6f76935891ca25ac168cab3809707f19d9
Signed-off-by: Laurent LEMELE <laurent.lemele@st.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5464
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/jtag/drivers/stlink_usb.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c index 6ab979f..d630c19 100644 --- a/src/jtag/drivers/stlink_usb.c +++ b/src/jtag/drivers/stlink_usb.c @@ -3705,7 +3705,12 @@ static int stlink_dap_speed(int speed) /** */ static int stlink_dap_khz(int khz, int *jtag_speed) { - *jtag_speed = khz; + if (khz == 0) { + LOG_ERROR("RCLK not supported"); + return ERROR_FAIL; + } + + *jtag_speed = stlink_speed(stlink_dap_handle, khz, true); return ERROR_OK; } |