This is an automated email from Gerrit.

Anonymous Coward ([email protected]) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/5337

-- gerrit

commit 500e881d69a51fe1ab0d014c23f2184baf4a37d5
Author: Alexandru Gagniuc <[email protected]>
Date:   Sun Oct 27 16:43:38 2019 -0500

    jtag: Add support for releasing SRST with CLK held low
    
    This sequence is required by some targets, such as AVR32 UC3, in order
    to enable the JTAG pins. Targets affected will not drive the TDO pin
    unless this sequence is done before any JTAG operation.
    
    We need to do this before the JTAG scan, so this is done on connect,
    or jtag_init(). This is consistent with how 'srst_nogate' is handled,
    and is specified 'reset_config'.
    
    I also considered adding this to the target (avr32_ap7k.c), but
    decided against it, because it would not allow the JTAG scan to work.
    Having this quirk declared as part of the reset config guarantees that
    the target JTAG is enabled before sending any JTAG waveforms.
    
    Change-Id: Ib4a9508eabda6d059cad2b8dc91af24f13bbffcb
    Signed-off-by: Alexandru Gagniuc <[email protected]>

diff --git a/src/jtag/adapter.c b/src/jtag/adapter.c
index 29a9613..6112d4b 100644
--- a/src/jtag/adapter.c
+++ b/src/jtag/adapter.c
@@ -258,6 +258,20 @@ COMMAND_HANDLER(handle_reset_config_command)
                if (m)
                        goto next;
 
+               /* Release SRST with TCKL held low */
+               m = RESET_CNCT_TCK_LOW_RELEASE_SRST;
+               if (strcmp(*CMD_ARGV, "connect_tck_low_deassert_srst") == 0)
+                       tmp |= RESET_CNCT_TCK_LOW_RELEASE_SRST;
+               else
+                       m = 0;
+               if (mask & m) {
+                       LOG_ERROR("extra reset_config %s spec (%s)",
+                                 "connect_type", *CMD_ARGV);
+                       return ERROR_COMMAND_SYNTAX_ERROR;
+               }
+               if (m)
+                       goto next;
+
                /* caller provided nonsense; fail */
                LOG_ERROR("unknown reset_config flag (%s)", *CMD_ARGV);
                return ERROR_COMMAND_SYNTAX_ERROR;
@@ -521,7 +535,8 @@ static const struct command_registration 
interface_command_handlers[] = {
                        "[srst_gates_jtag|srst_nogate] "
                        "[trst_push_pull|trst_open_drain] "
                        "[srst_push_pull|srst_open_drain] "
-                       "[connect_deassert_srst|connect_assert_srst]",
+                       "[connect_deassert_srst|connect_assert_srst] "
+                       "[connect_tck_low_deassert_srst] ",
        },
        COMMAND_REGISTRATION_DONE
 };
diff --git a/src/jtag/core.c b/src/jtag/core.c
index a7ea234..2ed9275 100644
--- a/src/jtag/core.c
+++ b/src/jtag/core.c
@@ -1653,6 +1653,17 @@ int jtag_init(struct command_context *cmd_ctx)
                else
                        LOG_WARNING("\'srst_nogate\' reset_config option is 
required");
        }
+
+       if (jtag_reset_config & RESET_CNCT_TCK_LOW_RELEASE_SRST) {
+               if (jtag_reset_config & RESET_HAS_SRST) {
+                       jtag_add_pins_cmd(0x00, JTAG_PIN_SRST | JTAG_PIN_TCK);
+                       jtag_add_sleep(10000);
+                       jtag_add_pins_cmd(0xff, JTAG_PIN_SRST);
+                       jtag_add_sleep(10000);
+               } else {
+                       LOG_WARNING("\'srst\' reset_config option is required");
+               }
+       }
        retval = jtag_execute_queue();
        if (retval != ERROR_OK)
                return retval;
diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h
index 0ab24b8..6aeab27 100644
--- a/src/jtag/jtag.h
+++ b/src/jtag/jtag.h
@@ -254,7 +254,8 @@ enum reset_types {
        RESET_TRST_OPEN_DRAIN = 0x10,
        RESET_SRST_PUSH_PULL  = 0x20,
        RESET_SRST_NO_GATING  = 0x40,
-       RESET_CNCT_UNDER_SRST = 0x80
+       RESET_CNCT_UNDER_SRST = 0x80,
+       RESET_CNCT_TCK_LOW_RELEASE_SRST = 0x100,
 };
 
 enum reset_types jtag_get_reset_config(void);

-- 


_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to