powerpc/85xx: sbc8560 - Fix warm reboot with board specific reset function
authorLiang Li <Liang.Li@windriver.com>
Fri, 14 Aug 2009 14:36:14 +0000 (10:36 -0400)
committerKumar Gala <galak@kernel.crashing.org>
Tue, 25 Aug 2009 01:48:12 +0000 (20:48 -0500)
The existing fsl_rstcr_restart function is not applicable to the
mpc8560. The Global Utilities Block on this earlier CPU doesn't have
the control/reset register at 0xe00b0.  This implements a board
specific reset function that uses the RCR(Reset Control Register) of
the sbc8560's EPLD to do a reset.

Signed-off-by: Liang Li <Liang.Li@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
arch/powerpc/platforms/85xx/sbc8560.c

index cc27807a8b64ab657a789d0b41ba2b111ef0d952..a5ad1c7794bfaa0183a5a1a8bbfc54c6f1d3c39e 100644 (file)
@@ -267,6 +267,43 @@ arch_initcall(sbc8560_rtc_init);
 
 #endif /* M48T59 */
 
+static __u8 __iomem *brstcr;
+
+static int __init sbc8560_bdrstcr_init(void)
+{
+       struct device_node *np;
+       struct resource res;
+
+       np = of_find_compatible_node(NULL, NULL, "wrs,sbc8560-brstcr");
+       if (np == NULL) {
+               printk(KERN_WARNING "sbc8560: No board specific RSTCR in DTB.\n");
+               return -ENODEV;
+       }
+
+       of_address_to_resource(np, 0, &res);
+
+       printk(KERN_INFO "sbc8560: Found BRSTCR at i/o 0x%x\n", res.start);
+
+       brstcr = ioremap(res.start, res.end - res.start);
+       if(!brstcr)
+               printk(KERN_WARNING "sbc8560: ioremap of brstcr failed.\n");
+
+       of_node_put(np);
+
+       return 0;
+}
+
+arch_initcall(sbc8560_bdrstcr_init);
+
+void sbc8560_rstcr_restart(char * cmd)
+{
+       local_irq_disable();
+       if(brstcr)
+               clrbits8(brstcr, 0x80);
+
+       while(1);
+}
+
 define_machine(sbc8560) {
        .name                   = "SBC8560",
        .probe                  = sbc8560_probe,
@@ -274,7 +311,7 @@ define_machine(sbc8560) {
        .init_IRQ               = sbc8560_pic_init,
        .show_cpuinfo           = sbc8560_show_cpuinfo,
        .get_irq                = mpic_get_irq,
-       .restart                = fsl_rstcr_restart,
+       .restart                = sbc8560_rstcr_restart,
        .calibrate_decr         = generic_calibrate_decr,
        .progress               = udbg_progress,
 };