This is an automated email from Gerrit.

Matthias Welwarsky (matth...@welwarsky.de) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/4345

-- gerrit

commit cc3c2a99e00b6cfb82aa96f5f08c3b18d0c22fd7
Author: Matthias Welwarsky <matthias.welwar...@sysgo.com>
Date:   Tue Jan 9 12:18:19 2018 +0100

    aarch64: fix reset handling
    
    make sure to only "reset halt" targets that were previously examined,
    make sure to only assert the reset line when SRST doesn't gate JTAG
    (or if transport is SWD)
    
    Change-Id: Ibeb2c488fa06a49c78e66b6d7a5c963e6301bc4c
    Signed-off-by: Matthias Welwarsky <matthias.welwar...@sysgo.com>

diff --git a/src/target/aarch64.c b/src/target/aarch64.c
index 5da4db3..7665928 100644
--- a/src/target/aarch64.c
+++ b/src/target/aarch64.c
@@ -28,6 +28,7 @@
 #include "target_type.h"
 #include "armv8_opcodes.h"
 #include "armv8_cache.h"
+#include <jtag/swd.h>
 #include <helper/time_support.h>
 
 enum restart_mode {
@@ -1637,7 +1638,14 @@ static int aarch64_assert_reset(struct target *target)
                /* REVISIT handle "pulls" cases, if there's
                 * hardware that needs them to work.
                 */
-               jtag_add_reset(0, 1);
+
+               /*
+                * FIXME: fix reset when transport is SWD. This is a temporary
+                * work-around for release v0.10 that is not intended to stay!
+                */
+               if (transport_is_swd() ||
+                               (target->reset_halt && (jtag_get_reset_config() 
& RESET_SRST_NO_GATING)))
+                       jtag_add_reset(0, 1);
        } else {
                LOG_ERROR("%s: how to reset?", target_name(target));
                return ERROR_FAIL;
@@ -1674,9 +1682,12 @@ static int aarch64_deassert_reset(struct target *target)
                if (target->state != TARGET_HALTED) {
                        LOG_WARNING("%s: ran after reset and before halt ...",
                                target_name(target));
-                       retval = target_halt(target);
-                       if (retval != ERROR_OK)
-                               return retval;
+                       if (target_was_examined(target)) {
+                               retval = target_halt(target);
+                               if (retval != ERROR_OK)
+                                       return retval;
+                       } else
+                               target->state = TARGET_UNKNOWN;
                }
        }
 
@@ -2304,11 +2315,9 @@ static int aarch64_examine_first(struct target *target)
 
 static int aarch64_examine(struct target *target)
 {
-       int retval = ERROR_OK;
+       int retval;
 
-       /* don't re-probe hardware after each reset */
-       if (!target_was_examined(target))
-               retval = aarch64_examine_first(target);
+       retval = aarch64_examine_first(target);
 
        /* Configure core debug access */
        if (retval == ERROR_OK)

-- 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to