The PSCI fixup code assumes the psci node is at /psci. This is not the case for all boards. TI AM62x upstream dtsi files have the psci node at /firmware/psci where the current code doesn't find it and creates a new node, so on this SoC we end up with two PSCI nodes. Fix this by searching for a node compatible to "arm,psci-0.2" or "arm,psci-1.0" instead of assuming a fixed location. Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> --- arch/arm/cpu/psci-of.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/arch/arm/cpu/psci-of.c b/arch/arm/cpu/psci-of.c index 1b6371ddd6..7c74860146 100644 --- a/arch/arm/cpu/psci-of.c +++ b/arch/arm/cpu/psci-of.c @@ -7,6 +7,24 @@ #include <asm/psci.h> #include <linux/arm-smccc.h> +static struct device_node *find_or_create_psci_node(struct device_node *root) +{ + struct device_node *psci; + const char *compat[] = { + "arm,psci-0.2", + "arm,psci-1.0" + }; + int i; + + for (i = 0; i < ARRAY_SIZE(compat); i++) { + psci = of_find_compatible_node(root, NULL, compat[i]); + if (psci) + return psci; + } + + return of_create_node(root, "/psci"); +} + int of_psci_fixup(struct device_node *root, unsigned long psci_version, const char *method) { @@ -15,10 +33,6 @@ int of_psci_fixup(struct device_node *root, unsigned long psci_version, const char *compat; struct device_node *cpus, *cpu; - psci = of_create_node(root, "/psci"); - if (!psci) - return -EINVAL; - if (psci_version >= ARM_PSCI_VER_1_0) { compat = "arm,psci-1.0"; } else if (psci_version >= ARM_PSCI_VER_0_2) { @@ -28,6 +42,10 @@ int of_psci_fixup(struct device_node *root, unsigned long psci_version, return -EINVAL; } + psci = find_or_create_psci_node(root); + if (!psci) + return -EINVAL; + cpus = of_find_node_by_path_from(root, "/cpus"); if (!cpus) { pr_err("Cannot find /cpus node, PSCI fixup aborting\n"); -- 2.39.5