Hi,

On Sat, 2008-10-11 at 21:07 -0400, John McCarthy wrote:
> On Sat, 2008-10-11 at 20:41 -0400, John McCarthy wrote:
> > Hi,
> > 
> > these two patches add a mips_m4k target option (ejtag_reset) to cause a
> 
> That should be ejtag_srst...
> 
> > reset command to use the EJTAG Peripheral and System Reset in addition
> > to srst.  This is for targets like the wrt54gl which do not connect the
> > srst to a system reset (I believe it just goes to a GPIO).
> > 
> > Is this the right way to do this.  It works fine but I wonder if there
> > is a better way to implement it.
> > 

haven't heard any comments on this as yet but here is an svn diff
version of the two patches combined as requested by Øyvind.


Cheers,
John McCarthy. 
Index: src/target/mips_m4k.c
===================================================================
--- src/target/mips_m4k.c	(revision 1047)
+++ src/target/mips_m4k.c	(working copy)
@@ -255,15 +255,22 @@
 		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);
+	if (strcmp(target->variant, "ejtag_srst") == 0) {
+		u32 ejtag_ctrl = ejtag_info->ejtag_ctrl | EJTAG_CTRL_PRRST | EJTAG_CTRL_PERRST;
+		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);
+		}
 	}
-	else
-	{
-		jtag_add_reset(0, 1);
-	}
 	
 	target->state = TARGET_RESET;
 	jtag_add_sleep(50000);
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to