diff --git a/src/jtag/amt_jtagaccel.c b/src/jtag/amt_jtagaccel.c
index 4071c25c984f285ba67e6dce74f0000327267c85..7d0dd53c2b92e1fe95778dd892052bf3761b7b91 100644
--- a/src/jtag/amt_jtagaccel.c
+++ b/src/jtag/amt_jtagaccel.c
@@ -500,6 +500,7 @@ static int amt_jtagaccel_init(void)
 
 	amt_jtagaccel_speed(jtag_get_speed());
 
+	enum reset_types jtag_reset_config = jtag_get_reset_config();
 	if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
 		aw_control_rst &= ~0x8;
 	else
diff --git a/src/jtag/bitbang.c b/src/jtag/bitbang.c
index 4e8dd2e34f8aba5ae1704e0328f1ed6184911ceb..f5bfd15e311cadcde25181a97ed3d5d814e9a9b7 100644
--- a/src/jtag/bitbang.c
+++ b/src/jtag/bitbang.c
@@ -258,7 +258,7 @@ int bitbang_execute_queue(void)
 #ifdef _DEBUG_JTAG_IO_
 				LOG_DEBUG("reset trst: %i srst %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst);
 #endif
-				if ((cmd->cmd.reset->trst == 1) || (cmd->cmd.reset->srst && (jtag_reset_config & RESET_SRST_PULLS_TRST)))
+				if ((cmd->cmd.reset->trst == 1) || (cmd->cmd.reset->srst && (jtag_get_reset_config() & RESET_SRST_PULLS_TRST)))
 				{
 					tap_set_state(TAP_RESET);
 				}
diff --git a/src/jtag/bitq.c b/src/jtag/bitq.c
index 9e0f4947fb266118759f8155de55a0434350c9c8..83e14e6687190eab62d78d48112384e30a7afc1f 100644
--- a/src/jtag/bitq.c
+++ b/src/jtag/bitq.c
@@ -298,7 +298,7 @@ int bitq_execute_queue(void)
 #ifdef _DEBUG_JTAG_IO_
 			LOG_DEBUG("reset trst: %i srst %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst);
 #endif
-			if ( (cmd->cmd.reset->trst == 1) || ( cmd->cmd.reset->srst && (jtag_reset_config & RESET_SRST_PULLS_TRST) ) )
+			if ( (cmd->cmd.reset->trst == 1) || ( cmd->cmd.reset->srst && (jtag_get_reset_config() & RESET_SRST_PULLS_TRST) ) )
 			{
 				tap_set_state(TAP_RESET);
 			}
diff --git a/src/jtag/core.c b/src/jtag/core.c
index f6db00a5c326d987337c022c623740d697e8cb70..0a587487e88a3cacd32d3ee65edd2e5231b5a0d6 100644
--- a/src/jtag/core.c
+++ b/src/jtag/core.c
@@ -1262,6 +1262,15 @@ int jtag_add_statemove(tap_state_t goal_state)
 	return ERROR_OK;
 }
 
+enum reset_types jtag_get_reset_config(void)
+{
+	return jtag_reset_config;
+}
+void jtag_set_reset_config(enum reset_types type)
+{
+	jtag_reset_config = type;
+}
+
 int jtag_get_trst(void)
 {
 	return jtag_trst;
diff --git a/src/jtag/dummy.c b/src/jtag/dummy.c
index 9d4a436b597dfc8da0e04e2c5af9ece950c92706..2ad8c10fabce53c20aa4b43325aff64b65cf8c30 100644
--- a/src/jtag/dummy.c
+++ b/src/jtag/dummy.c
@@ -123,7 +123,7 @@ static void dummy_reset(int trst, int srst)
 {
 	dummy_clock = 0;
 
-	if (trst || (srst && (jtag_reset_config & RESET_SRST_PULLS_TRST)))
+	if (trst || (srst && (jtag_get_reset_config() & RESET_SRST_PULLS_TRST)))
 		dummy_state = TAP_RESET;
 
 	LOG_DEBUG("reset to: %s", tap_state_name(dummy_state) );
diff --git a/src/jtag/ft2232.c b/src/jtag/ft2232.c
index 734833b125594408e3d36a49a5c376aea29d3203..4bc2f3fe43e6f4dbaab6354c756da8ada641a1af 100644
--- a/src/jtag/ft2232.c
+++ b/src/jtag/ft2232.c
@@ -1193,6 +1193,7 @@ static int ft2232_predict_scan_in(int scan_size, enum scan_type type)
 
 static void usbjtag_reset(int trst, int srst)
 {
+	enum reset_types jtag_reset_config = jtag_get_reset_config();
 	if (trst == 1)
 	{
 		if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
@@ -1232,6 +1233,7 @@ static void usbjtag_reset(int trst, int srst)
 
 static void jtagkey_reset(int trst, int srst)
 {
+	enum reset_types jtag_reset_config = jtag_get_reset_config();
 	if (trst == 1)
 	{
 		if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
@@ -1273,6 +1275,7 @@ static void jtagkey_reset(int trst, int srst)
 
 static void olimex_jtag_reset(int trst, int srst)
 {
+	enum reset_types jtag_reset_config = jtag_get_reset_config();
 	if (trst == 1)
 	{
 		if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
@@ -2155,6 +2158,7 @@ static int usbjtag_init(void)
 		return ERROR_JTAG_INIT_FAILED;
 	}
 
+	enum reset_types jtag_reset_config = jtag_get_reset_config();
 	if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
 	{
 		low_direction &= ~nTRSTnOE; /* nTRST input */
@@ -2229,6 +2233,7 @@ static int axm0432_jtag_init(void)
 	high_output    = 0x0;
 	high_direction = 0x0c;
 
+	enum reset_types jtag_reset_config = jtag_get_reset_config();
 	if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
 	{
 		LOG_ERROR("can't set nTRSTOE to push-pull on the Dicarlo jtag");
@@ -2307,6 +2312,7 @@ static int jtagkey_init(void)
 	high_output    = 0x0;
 	high_direction = 0x0f;
 
+	enum reset_types jtag_reset_config = jtag_get_reset_config();
 	if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
 	{
 		high_output |= nTRSTnOE;
@@ -2373,6 +2379,7 @@ static int olimex_jtag_init(void)
 	high_output    = 0x0;
 	high_direction = 0x0f;
 
+	enum reset_types jtag_reset_config = jtag_get_reset_config();
 	if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
 	{
 		high_output |= nTRSTnOE;
@@ -2944,6 +2951,7 @@ static int icebear_jtag_init(void) {
 	nTRST		= 0x10;
 	nSRST		= 0x20;
 
+	enum reset_types jtag_reset_config = jtag_get_reset_config();
 	if ((jtag_reset_config & RESET_TRST_OPEN_DRAIN) != 0) {
 		low_direction	&= ~nTRST;	/* nTRST high impedance */
 	}
@@ -2991,6 +2999,7 @@ static void icebear_jtag_reset(int trst, int srst) {
 		low_output	&= ~nTRST;
 	}
 	else if (trst == 0) {
+		enum reset_types jtag_reset_config = jtag_get_reset_config();
 		if ((jtag_reset_config & RESET_TRST_OPEN_DRAIN) != 0)
 			low_direction	&= ~nTRST;
 		else
diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h
index 1b0bed0e9dbb410fab7d45d336dc08b9c9d0fa79..515f296912025aa3b9d32d631c80b3399c7627e6 100644
--- a/src/jtag/jtag.h
+++ b/src/jtag/jtag.h
@@ -277,7 +277,8 @@ enum reset_types {
 	RESET_SRST_PUSH_PULL  = 0x20,
 };
 
-extern enum reset_types jtag_reset_config;
+enum reset_types jtag_get_reset_config(void);
+void jtag_set_reset_config(enum reset_types type);
 
 /**
  * Initialize interface upon startup.  Return a successful no-op upon
diff --git a/src/jtag/rlink/rlink.c b/src/jtag/rlink/rlink.c
index 121de01ff182e637cedc5e36a5ec528b257affec..554cca29311bfdb278ea7c2681ab06a48370d412 100644
--- a/src/jtag/rlink/rlink.c
+++ b/src/jtag/rlink/rlink.c
@@ -1419,7 +1419,7 @@ int rlink_execute_queue(void)
 #ifdef _DEBUG_JTAG_IO_
 				LOG_DEBUG("reset trst: %i srst %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst);
 #endif
-				if ((cmd->cmd.reset->trst == 1) || (cmd->cmd.reset->srst && (jtag_reset_config & RESET_SRST_PULLS_TRST)))
+				if ((cmd->cmd.reset->trst == 1) || (cmd->cmd.reset->srst && (jtag_get_reset_config() & RESET_SRST_PULLS_TRST)))
 				{
 					tap_set_state(TAP_RESET);
 				}
diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c
index ed24498b87e10e2847aa224bdbc7dac730afb384..121c19abca4b698783716d096c0fd266777848f0 100644
--- a/src/jtag/tcl.c
+++ b/src/jtag/tcl.c
@@ -921,8 +921,10 @@ next:
 	}
 
 	/* clear previous values of those bits, save new values */
-	jtag_reset_config &= ~mask;
-	jtag_reset_config |= new_cfg;
+	enum reset_types old_cfg = jtag_get_reset_config();
+	old_cfg &= ~mask;
+	new_cfg |= old_cfg;
+	jtag_set_reset_config(new_cfg);
 
 	return ERROR_OK;
 }
diff --git a/src/jtag/zy1000/zy1000.c b/src/jtag/zy1000/zy1000.c
index 05bbd4c5cd0d24a2437bb90f7bb4ae796de82c5d..4dbdef249192d86013d3e6ed204d2adedefff788 100644
--- a/src/jtag/zy1000/zy1000.c
+++ b/src/jtag/zy1000/zy1000.c
@@ -164,7 +164,7 @@ void zy1000_reset(int trst, int srst)
 		ZY1000_POKE(ZY1000_JTAG_BASE+0x10, 0x00000002);
 	}
 
-	if (trst||(srst&&(jtag_reset_config & RESET_SRST_PULLS_TRST)))
+	if (trst||(srst&&(jtag_get_reset_config() & RESET_SRST_PULLS_TRST)))
 	{
 		waitIdle();
 		/* we're now in the RESET state until trst is deasserted */
diff --git a/src/target/arm7_9_common.c b/src/target/arm7_9_common.c
index 9ec3e6c85dadb936c03e2b660ac9af2e63c21557..493cf02d1eb7b6a0c817d05561e22a247e0b487a 100644
--- a/src/target/arm7_9_common.c
+++ b/src/target/arm7_9_common.c
@@ -905,6 +905,7 @@ int arm7_9_poll(target_t *target)
 			{
 				if (target->reset_halt)
 				{
+					enum reset_types jtag_reset_config = jtag_get_reset_config();
 					if ((jtag_reset_config & RESET_SRST_PULLS_TRST)==0)
 					{
 						check_pc = 1;
@@ -975,6 +976,7 @@ int arm7_9_assert_reset(target_t *target)
 	LOG_DEBUG("target->state: %s",
 		  Jim_Nvp_value2name_simple( nvp_target_state,target->state)->name);
 
+	enum reset_types jtag_reset_config = jtag_get_reset_config();
 	if (!(jtag_reset_config & RESET_HAS_SRST))
 	{
 		LOG_ERROR("Can't assert SRST");
@@ -1047,6 +1049,7 @@ int arm7_9_deassert_reset(target_t *target)
 	/* deassert reset lines */
 	jtag_add_reset(0, 0);
 
+	enum reset_types jtag_reset_config = jtag_get_reset_config();
 	if (target->reset_halt&&(jtag_reset_config & RESET_SRST_PULLS_TRST)!=0)
 	{
 		LOG_WARNING("srst pulls trst - can not reset into halted mode. Issuing halt after reset.");
diff --git a/src/target/cortex_m3.c b/src/target/cortex_m3.c
index efa94ea4f1eb55e35604e7f149ef2c9568b01059..ab2c8f8e7d35a2439bae4559e19ac0b46e4747ba 100644
--- a/src/target/cortex_m3.c
+++ b/src/target/cortex_m3.c
@@ -544,7 +544,7 @@ int cortex_m3_halt(target_t *target)
 
 	if (target->state == TARGET_RESET)
 	{
-		if ((jtag_reset_config & RESET_SRST_PULLS_TRST) && jtag_get_srst())
+		if ((jtag_get_reset_config() & RESET_SRST_PULLS_TRST) && jtag_get_srst())
 		{
 			LOG_ERROR("can't request a halt while in reset if nSRST pulls nTRST");
 			return ERROR_TARGET_FAILURE;
@@ -753,6 +753,7 @@ int cortex_m3_assert_reset(target_t *target)
 	LOG_DEBUG("target->state: %s",
 		Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name );
 
+	enum reset_types jtag_reset_config = jtag_get_reset_config();
 	if (!(jtag_reset_config & RESET_HAS_SRST))
 	{
 		LOG_ERROR("Can't assert SRST");
diff --git a/src/target/mips_m4k.c b/src/target/mips_m4k.c
index 466e0a2d5025c0b6041ae7b4b3e9e4513f67a7df..5e98a2a0a18477acf021f46c6b13a5d39e9a59a7 100644
--- a/src/target/mips_m4k.c
+++ b/src/target/mips_m4k.c
@@ -235,7 +235,7 @@ int mips_m4k_halt(struct target_s *target)
 
 	if (target->state == TARGET_RESET)
 	{
-		if ((jtag_reset_config & RESET_SRST_PULLS_TRST) && jtag_get_srst())
+		if ((jtag_get_reset_config() & RESET_SRST_PULLS_TRST) && jtag_get_srst())
 		{
 			LOG_ERROR("can't request a halt while in reset if nSRST pulls nTRST");
 			return ERROR_TARGET_FAILURE;
@@ -267,6 +267,7 @@ int mips_m4k_assert_reset(target_t *target)
 	LOG_DEBUG("target->state: %s",
 		Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name);
 
+	enum reset_types jtag_reset_config = jtag_get_reset_config();
 	if (!(jtag_reset_config & RESET_HAS_SRST))
 	{
 		LOG_ERROR("Can't assert SRST");