Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux...
[sfrench/cifs-2.6.git] / arch / powerpc / sysdev / ppc4xx_soc.c
index 5c014350bf16fdc379d3be5c203b7f52e925a227..d3d6ce3c33b4740507dbfd0fdacdbd85e984047d 100644 (file)
@@ -191,11 +191,31 @@ static int __init ppc4xx_l2c_probe(void)
 arch_initcall(ppc4xx_l2c_probe);
 
 /*
- * At present, this routine just applies a system reset.
+ * Apply a system reset. Alternatively a board specific value may be
+ * provided via the "reset-type" property in the cpu node.
  */
 void ppc4xx_reset_system(char *cmd)
 {
-       mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR0_RST_SYSTEM);
+       struct device_node *np;
+       u32 reset_type = DBCR0_RST_SYSTEM;
+       const u32 *prop;
+
+       np = of_find_node_by_type(NULL, "cpu");
+       if (np) {
+               prop = of_get_property(np, "reset-type", NULL);
+
+               /*
+                * Check if property exists and if it is in range:
+                * 1 - PPC4xx core reset
+                * 2 - PPC4xx chip reset
+                * 3 - PPC4xx system reset (default)
+                */
+               if ((prop) && ((prop[0] >= 1) && (prop[0] <= 3)))
+                       reset_type = prop[0] << 28;
+       }
+
+       mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | reset_type);
+
        while (1)
                ;       /* Just in case the reset doesn't work */
 }