>From 8296dac1d74c65a40ae0cf24d1ee3352c58d3a7f Mon Sep 17 00:00:00 2001
From: John McCarthy <jgmcc@magma.ca>
Date: Sun, 5 Oct 2008 21:33:12 -0400
Subject: [PATCH] Add target variant ejtag_reset to use PrRst EJTAG control bit to reset processor.

Signed-off-by: John McCarthy <jgmcc@magma.ca>
---
 src/target/mips_m4k.c |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diff --git src/target/mips_m4k.c src/target/mips_m4k.c
index 3508ebd..fc4c27e 100644
--- src/target/mips_m4k.c
+++ src/target/mips_m4k.c
@@ -255,14 +255,21 @@ int mips_m4k_assert_reset(target_t *target)
 		mips_ejtag_set_instr(ejtag_info, EJTAG_INST_NORMALBOOT, NULL);
 	}
 	
-	/* here we should issue a srst only, but we may have to assert trst as well */
-	if (jtag_reset_config & RESET_SRST_PULLS_TRST)
-	{
-		jtag_add_reset(1, 1);
-	}
-	else
-	{
-		jtag_add_reset(0, 1);
+	if (strcmp(target->variant, "ejtag_srst") == 0) {
+		u32 ejtag_ctrl = ejtag_info->ejtag_ctrl | EJTAG_CTRL_PRRST;
+		LOG_DEBUG("Using EJTAG reset (PRRST) to reset processor...");
+		mips_ejtag_set_instr(ejtag_info, EJTAG_INST_CONTROL, NULL);
+		mips_ejtag_drscan_32(ejtag_info, &ejtag_ctrl);
+	} else {
+		/* here we should issue a srst only, but we may have to assert trst as well */
+		if (jtag_reset_config & RESET_SRST_PULLS_TRST)
+		{
+			jtag_add_reset(1, 1);
+		}
+		else
+		{
+			jtag_add_reset(0, 1);
+		}
 	}
 	
 	target->state = TARGET_RESET;
-- 
1.5.4.3

