Merge tag 'u-boot-imx-20200825' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
[platform/kernel/u-boot.git] / drivers / firmware / psci.c
index 394f30f..68953cc 100644 (file)
@@ -7,22 +7,30 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <dm.h>
 #include <irq_func.h>
+#include <log.h>
 #include <dm/lists.h>
 #include <efi_loader.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <linux/arm-smccc.h>
 #include <linux/errno.h>
 #include <linux/printk.h>
 #include <linux/psci.h>
+#include <asm/system.h>
 
 #define DRIVER_NAME "psci"
 
 #define PSCI_METHOD_HVC 1
 #define PSCI_METHOD_SMC 2
 
+#if CONFIG_IS_ENABLED(EFI_LOADER)
 int __efi_runtime_data psci_method;
+#else
+int psci_method __attribute__ ((section(".data")));
+#endif
 
 unsigned long __efi_runtime invoke_psci_fn
                (unsigned long function_id, unsigned long arg0,
@@ -64,11 +72,14 @@ static int psci_bind(struct udevice *dev)
 
 static int psci_probe(struct udevice *dev)
 {
-       DECLARE_GLOBAL_DATA_PTR;
        const char *method;
 
-       method = fdt_stringlist_get(gd->fdt_blob, dev_of_offset(dev), "method",
-                                   0, NULL);
+#if defined(CONFIG_ARM64)
+       if (current_el() == 3)
+               return -EINVAL;
+#endif
+
+       method = ofnode_read_string(dev_ofnode(dev), "method");
        if (!method) {
                pr_warn("missing \"method\" property\n");
                return -ENXIO;
@@ -131,7 +142,7 @@ void reset_misc(void)
 #endif /* CONFIG_PSCI_RESET */
 
 #ifdef CONFIG_CMD_POWEROFF
-int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
        do_psci_probe();