This is an automated email from Gerrit.

"Tomas Vanek <[email protected]>" just uploaded a new patch set to Gerrit, which 
you can find at https://review.openocd.org/c/openocd/+/9605

-- gerrit

commit 192c2908a9d7b6a73a24dae5e75f31e12e4812ea
Author: Tomas Vanek <[email protected]>
Date:   Wed Apr 29 11:07:21 2026 +0200

    jtag/core: fix is_jtag_poll_safe() logic
    
    RESET_SRST_NO_GATING reset config option is used also for
    other transports, mainly for SWD.
    
    Disable polling implicitly while SRST is gating the debug
    HW regardless the selected transport.
    
    While on it, add FIXME comment to mark similar issue with
    sensed SRST signal. Currently there is no support for
    SRST sensing in drivers so no way to test eventual change.
    
    Change-Id: I88a7cbd5141b4343db9877d386f9ff37630b5fca
    Signed-off-by: Tomas Vanek <[email protected]>

diff --git a/src/jtag/core.c b/src/jtag/core.c
index 3261e60796..ae16c8f7b1 100644
--- a/src/jtag/core.c
+++ b/src/jtag/core.c
@@ -148,18 +148,15 @@ static bool jtag_poll_en = true;
 bool is_jtag_poll_safe(void)
 {
        /* Polling can be disabled explicitly with set_enabled(false).
-        * It can also be masked with mask().
-        * It is also implicitly disabled while TRST is active and
-        * while SRST is gating the JTAG clock.
-        */
-       if (!jtag_poll_en)
+        * It can also be masked with mask(). */
+       if (!jtag_poll_en || !jtag_poll)
                return false;
 
-       if (!transport_is_jtag())
-               return jtag_poll;
-
-       if (!jtag_poll || jtag_trst != 0)
+       /* On JTAG transport it is also implicitly disabled while TRST is 
active */
+       if (transport_is_jtag() && jtag_trst)
                return false;
+
+       /* On any transport while SRST is gating the JTAG clock or other debug 
HW */
        return jtag_srst == 0 || (jtag_reset_config & RESET_SRST_NO_GATING);
 }
 
diff --git a/src/target/target.c b/src/target/target.c
index ad7a9d0118..fb8c08f38d 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -2944,6 +2944,8 @@ static int handle_target(void *priv)
                recursive = 0;
        }
 
+       /* FIXME: sensed SRST state should be treated similarly as
+        * active SRST control and honour reset config RESET_SRST_NO_GATING */
        if (sensed_power_dropout || sensed_srst_asserted)
                return ERROR_OK;
 

-- 

Reply via email to