LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mpc512x: Reset module
@ 2009-09-07  0:06 Damien Dusha
  2009-09-07  8:13 ` Wolfram Sang
  0 siblings, 1 reply; 2+ messages in thread
From: Damien Dusha @ 2009-09-07  0:06 UTC (permalink / raw)
  To: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 443 bytes --]

Dear all,

I have written a small patch to get the software reset working on the
mpc5121.  It is similar to the reset driver found in
arch/powerpc/platforms/83xx/misc.c except it has been modified to look
for the reset node in the device tree before writing to the reset
module.

Comments are welcome.  It's my first patch to the mailing list, so
I'll apologise in advance for any problems with the submission
procedure.

Damien.

[-- Attachment #2: mpc512x_restart.patch --]
[-- Type: text/x-patch, Size: 2005 bytes --]

diff --git a/arch/powerpc/platforms/512x/mpc5121_ads.c b/arch/powerpc/platforms/512x/mpc5121_ads.c
index a8976b4..16ca250 100644
--- a/arch/powerpc/platforms/512x/mpc5121_ads.c
+++ b/arch/powerpc/platforms/512x/mpc5121_ads.c
@@ -70,4 +70,5 @@ define_machine(mpc5121_ads) {
 	.init_IRQ		= mpc5121_ads_init_IRQ,
 	.get_irq		= ipic_get_irq,
 	.calibrate_decr		= generic_calibrate_decr,
+    .restart        = mpc512x_restart,
 };
diff --git a/arch/powerpc/platforms/512x/mpc512x.h b/arch/powerpc/platforms/512x/mpc512x.h
index f4db8a7..d77f0ab 100644
--- a/arch/powerpc/platforms/512x/mpc512x.h
+++ b/arch/powerpc/platforms/512x/mpc512x.h
@@ -14,5 +14,6 @@
 extern unsigned long mpc512x_find_ips_freq(struct device_node *node);
 extern void __init mpc512x_init_IRQ(void);
 extern void __init mpc512x_init_i2c(void);
+extern void mpc512x_restart(char *cmd);
 void __init mpc512x_declare_of_platform_devices(void);
 #endif				/* __MPC512X_H__ */
diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c b/arch/powerpc/platforms/512x/mpc512x_shared.c
index 135fd6b..deddafc 100644
--- a/arch/powerpc/platforms/512x/mpc512x_shared.c
+++ b/arch/powerpc/platforms/512x/mpc512x_shared.c
@@ -22,6 +22,7 @@
 #include <asm/prom.h>
 #include <asm/time.h>
 
+#include <asm/mpc512x.h>
 #include "mpc512x.h"
 
 unsigned long
@@ -89,6 +90,33 @@ void __init mpc512x_init_i2c(void)
 	}
 }
 
+void mpc512x_restart(char *cmd)
+{
+    struct device_node *np;
+    struct mpc512x_reset_module *rm;
+
+    local_irq_disable();
+
+	np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-reset");
+
+	if (np) {
+
+        rm = of_iomap(np, 0);
+		if (rm) {
+
+            /* Enable software reset "RSTE" (in hex) */
+            out_be32( &(rm->rpr) , 0x52535445);
+
+            /* Set the software hard reset */
+            out_be32( &(rm->rcr), 0x2);
+        }
+	}
+
+    printk (KERN_EMERG "Error: Unable to map reset module, spinning forever!\n");
+    for(;;);
+}
+
+
 /*
  * Nodes to do bus probe on, soc and localbus
  */

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-09-07  8:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-07  0:06 [PATCH] mpc512x: Reset module Damien Dusha
2009-09-07  8:13 ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox