linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] add restart function for mpc52xx
@ 2007-01-11 12:28 Sascha Hauer
  2007-01-11 13:15 ` Sylvain Munaut
  2007-01-11 13:59 ` Kumar Gala
  0 siblings, 2 replies; 20+ messages in thread
From: Sascha Hauer @ 2007-01-11 12:28 UTC (permalink / raw)
  To: linuxppc-dev

This patch adds restart support for mpx52xx systems.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

---
 arch/powerpc/platforms/52xx/lite5200.c       |    1 +
 arch/powerpc/platforms/52xx/mpc52xx_common.c |   15 +++++++++++++++
 include/asm-powerpc/mpc52xx.h                |    2 ++
 3 files changed, 18 insertions(+)

Index: linux-2.6/arch/powerpc/platforms/52xx/lite5200.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/52xx/lite5200.c
+++ linux-2.6/arch/powerpc/platforms/52xx/lite5200.c
@@ -153,6 +153,7 @@ define_machine(lite52xx) {
 	.name 		= "lite52xx",
 	.probe 		= lite52xx_probe,
 	.setup_arch 	= lite52xx_setup_arch,
+	.restart	= mpc52xx_restart,
 	.init		= mpc52xx_declare_of_platform_devices,
 	.init_IRQ 	= mpc52xx_init_irq,
 	.get_irq 	= mpc52xx_get_irq,
Index: linux-2.6/arch/powerpc/platforms/52xx/mpc52xx_common.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ linux-2.6/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -75,6 +75,21 @@ mpc52xx_find_ipb_freq(struct device_node
 }
 EXPORT_SYMBOL(mpc52xx_find_ipb_freq);
 
+void
+mpc52xx_restart(char *cmd)
+{
+	struct mpc52xx_gpt *gpt = mpc52xx_find_and_map("mpc52xx-gpt");
+
+	local_irq_disable();
+
+	/* Turn on the watchdog and wait for it to expire. It effectively
+	  does a reset */
+	out_be32(&gpt->mode, 0x00000000);
+	out_be32(&gpt->count, 0x0000000ff);
+	out_be32(&gpt->mode, 0x00009004);
+
+	while (1);
+}
 
 void __init
 mpc52xx_setup_cpu(void)
Index: linux-2.6/include/asm-powerpc/mpc52xx.h
===================================================================
--- linux-2.6.orig/include/asm-powerpc/mpc52xx.h
+++ linux-2.6/include/asm-powerpc/mpc52xx.h
@@ -249,6 +249,8 @@ extern void mpc52xx_declare_of_platform_
 extern void mpc52xx_init_irq(void);
 extern unsigned int mpc52xx_get_irq(void);
 
+extern void mpc52xx_restart(char *cmd);
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __ASM_POWERPC_MPC52xx_H__ */


-- 
 Dipl.-Ing. Sascha Hauer | http://www.pengutronix.de
  Pengutronix - Linux Solutions for Science and Industry
    Handelsregister: Amtsgericht Hildesheim, HRA 2686
      Hannoversche Str. 2, 31134 Hildesheim, Germany
    Phone: +49-5121-206917-0 |  Fax: +49-5121-206917-9

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

end of thread, other threads:[~2007-01-28 23:56 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-11 12:28 [PATCH] add restart function for mpc52xx Sascha Hauer
2007-01-11 13:15 ` Sylvain Munaut
2007-01-11 13:59 ` Kumar Gala
2007-01-11 15:21   ` Sascha Hauer
2007-01-11 15:50     ` Grant Likely
2007-01-11 16:20       ` Grant Likely
2007-01-11 16:57         ` Segher Boessenkool
2007-01-12  3:37     ` Paul Mackerras
2007-01-12  8:46       ` Sascha Hauer
2007-01-12  9:00         ` Sylvain Munaut
2007-01-12 10:42           ` Sascha Hauer
2007-01-12 10:43             ` Sylvain Munaut
2007-01-12 16:05               ` Kumar Gala
2007-01-12 12:27             ` Segher Boessenkool
2007-01-28 18:09               ` Robert Schwebel
2007-01-28 21:48                 ` Benjamin Herrenschmidt
2007-01-28 23:56                   ` David Gibson
2007-01-12 12:23           ` Segher Boessenkool
2007-01-12 12:39             ` Sylvain Munaut
2007-01-12 12:19         ` Segher Boessenkool

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).