]> git.sur5r.net Git - openocd/commitdiff
ftdi: fix adapter_init rclk fallback
authorSpencer Oliver <spen@spen-soft.co.uk>
Mon, 24 Sep 2012 11:29:47 +0000 (12:29 +0100)
committerSpencer Oliver <spen@spen-soft.co.uk>
Thu, 4 Oct 2012 15:58:46 +0000 (15:58 +0000)
adapter_init expects jtag_get_speed (via ftdi_khz) to return a valid
fallback speed if the adapter does not support rclk. The call was failing
and so was the rest of the adapter init.

The makes the new ftdi driver emulate the old ftdi driver.

Change-Id: Ic7fac7d201241eb181e98f1ba7111f159731f6e0
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/877
Tested-by: jenkins
src/jtag/drivers/ftdi.c

index 0a2aec2225e0026b5a0604af4e1d91551f11f2b0..f04b390c1717b1c541c2e3e81fa9daa1cbda8ff3 100644 (file)
@@ -247,6 +247,11 @@ static int ftdi_speed_div(int speed, int *khz)
 
 static int ftdi_khz(int khz, int *jtag_speed)
 {
+       if (khz == 0 && !mpsse_is_high_speed(mpsse_ctx)) {
+               LOG_DEBUG("RCLK not supported");
+               return ERROR_FAIL;
+       }
+
        *jtag_speed = khz * 1000;
        return ERROR_OK;
 }