parport: fix parport_toggling_time regression

If parport_toggling_time is called before the adapter speed has been
configured then the call fails. Probably not the best fix, but does at least
enable parport_toggling_time to be used again.

This regression was added in commit 740b9e25b4

Change-Id: I90300916d6bda5ef053c557e5ac136c4f002bdd1
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1309
Tested-by: jenkins
This commit is contained in:
Spencer Oliver 2013-03-26 15:23:16 +00:00
parent 46bcaec696
commit 0a33b7b2aa
1 changed files with 7 additions and 2 deletions

View File

@ -452,8 +452,13 @@ COMMAND_HANDLER(parport_handle_parport_toggling_time_command)
parport_toggling_time_ns = ns;
retval = jtag_get_speed(&wait_states);
if (retval != ERROR_OK)
return retval;
if (retval != ERROR_OK) {
/* if jtag_get_speed fails then the clock_mode
* has not been configured, this happens if parport_toggling_time is
* called before the adapter speed is set */
LOG_INFO("no parport speed set - defaulting to zero wait states");
wait_states = 0;
}
}
command_print(CMD_CTX, "parport toggling time = %" PRIu32 " ns",