Merge branch 'linus'
[firefly-linux-kernel-4.4.55.git] / arch / powerpc / platforms / maple / setup.c
index 094989d50babaf0bdfe46db5e4b3ab1cd1531924..82d3f9e28d7ce05a2170e19b730dea92d9662c83 100644 (file)
@@ -60,7 +60,9 @@
 #include <asm/of_device.h>
 #include <asm/lmb.h>
 #include <asm/mpic.h>
+#include <asm/rtas.h>
 #include <asm/udbg.h>
+#include <asm/nvram.h>
 
 #include "maple.h"
 
@@ -166,6 +168,16 @@ struct smp_ops_t maple_smp_ops = {
 };
 #endif /* CONFIG_SMP */
 
+static void __init maple_use_rtas_reboot_and_halt_if_present(void)
+{
+       if (rtas_service_present("system-reboot") &&
+           rtas_service_present("power-off")) {
+               ppc_md.restart = rtas_restart;
+               ppc_md.power_off = rtas_power_off;
+               ppc_md.halt = rtas_halt;
+       }
+}
+
 void __init maple_setup_arch(void)
 {
        /* init to some ~sane value until calibrate_delay() runs */
@@ -181,8 +193,11 @@ void __init maple_setup_arch(void)
 #ifdef CONFIG_DUMMY_CONSOLE
        conswitchp = &dummy_con;
 #endif
+       maple_use_rtas_reboot_and_halt_if_present();
 
        printk(KERN_DEBUG "Using native/NAP idle loop\n");
+
+       mmio_nvram_init();
 }
 
 /* 
@@ -242,7 +257,6 @@ static void __init maple_init_IRQ(void)
                printk(KERN_DEBUG "OpenPIC addr: %lx, has ISUs: %d\n",
                       openpic_addr, has_isus);
        }
-       of_node_put(root);
 
        BUG_ON(openpic_addr == 0);