powerpc/fsl_soc: Search all global-utilities nodes for rstccr
authorMatthew McClintock <msm@freescale.com>
Tue, 31 Aug 2010 22:44:51 +0000 (17:44 -0500)
committerKumar Gala <galak@kernel.crashing.org>
Thu, 14 Oct 2010 05:52:56 +0000 (00:52 -0500)
The first global-utilities node might not contain the rstcr
property, so we should search all the nodes

Signed-off-by: Matthew McClintock <msm@freescale.com>
Acked-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
arch/powerpc/sysdev/fsl_soc.c

index b91f7acdda6f72aa09d49669258d18e2d9527a73..6c67d9ebf1669e80886614e1e3d3b78528716e62 100644 (file)
@@ -378,17 +378,23 @@ static __be32 __iomem *rstcr;
 static int __init setup_rstcr(void)
 {
        struct device_node *np;
-       np = of_find_node_by_name(NULL, "global-utilities");
-       if ((np && of_get_property(np, "fsl,has-rstcr", NULL))) {
-               rstcr = of_iomap(np, 0) + 0xb0;
-               if (!rstcr)
-                       printk (KERN_EMERG "Error: reset control register "
-                                       "not mapped!\n");
-       } else if (ppc_md.restart == fsl_rstcr_restart)
+
+       for_each_node_by_name(np, "global-utilities") {
+               if ((of_get_property(np, "fsl,has-rstcr", NULL))) {
+                       rstcr = of_iomap(np, 0) + 0xb0;
+                       if (!rstcr)
+                               printk (KERN_ERR "Error: reset control "
+                                               "register not mapped!\n");
+                       break;
+               }
+       }
+
+       if (!rstcr && ppc_md.restart == fsl_rstcr_restart)
                printk(KERN_ERR "No RSTCR register, warm reboot won't work\n");
 
        if (np)
                of_node_put(np);
+
        return 0;
 }