This is an automated email from Gerrit.

"Erhan Kurubas <erhan.kuru...@espressif.com>" just uploaded a new patch set to 
Gerrit, which you can find at https://review.openocd.org/c/openocd/+/7004

-- gerrit

commit d07fd9d40c880ab0dd90c2e0c37fe2148feadb05
Author: Erhan Kurubas <erhan.kuru...@espressif.com>
Date:   Thu May 26 22:43:41 2022 +0200

    adapter: run at default speed when clock speed not specified
    
    Signed-off-by: Erhan Kurubas <erhan.kuru...@espressif.com>
    Change-Id: I8d2db4a1f618790907265a45d28a212551800b6c

diff --git a/src/jtag/adapter.c b/src/jtag/adapter.c
index 14452d42f2..d09be6dc7a 100644
--- a/src/jtag/adapter.c
+++ b/src/jtag/adapter.c
@@ -36,6 +36,8 @@ enum adapter_clk_mode {
        CLOCK_MODE_RCLK
 };
 
+#define DEFAULT_CLOCK_SPEED_KHZ                10000U
+
 /**
  * Adapter configuration
  */
@@ -70,21 +72,26 @@ int adapter_init(struct command_context *cmd_ctx)
        }
 
        int retval;
+
+       if (adapter_config.clock_mode == CLOCK_MODE_UNSELECTED) {
+               LOG_WARNING("An adapter speed is not selected in the init 
script."
+                       " Insert a call to \"adapter speed\" or \"jtag_rclk\" 
to proceed.");
+               LOG_WARNING("Adapter will run at default speed!");
+               retval = adapter_config_khz(DEFAULT_CLOCK_SPEED_KHZ);
+               if (retval != ERROR_OK)
+                       return ERROR_JTAG_INIT_FAILED;
+       }
+
        retval = adapter_driver->init();
        if (retval != ERROR_OK)
                return retval;
-       adapter_config.adapter_initialized = true;
 
        if (!adapter_driver->speed) {
                LOG_INFO("This adapter doesn't support configurable speed");
                return ERROR_OK;
        }
 
-       if (adapter_config.clock_mode == CLOCK_MODE_UNSELECTED) {
-               LOG_ERROR("An adapter speed is not selected in the init script."
-                       " Insert a call to \"adapter speed\" or \"jtag_rclk\" 
to proceed.");
-               return ERROR_JTAG_INIT_FAILED;
-       }
+       adapter_config.adapter_initialized = true;
 
        int requested_khz = adapter_get_speed_khz();
        int actual_khz = requested_khz;

-- 

Reply via email to