ARM: psci: add probe function to discover presence of a psci implementation
authorAchin Gupta <achin.gupta@arm.com>
Sun, 16 Dec 2012 23:11:32 +0000 (23:11 +0000)
committerJon Medhurst <tixy@linaro.org>
Mon, 1 Jul 2013 10:05:02 +0000 (11:05 +0100)
This patch adds a probe function to check if the secure firmware has an
implementation of the Power State Coordination Interface.

'bL_platform_power_ops' will be implemented by:

a. a native backend when Linux runs in secure world
b. a psci backend which relies on the secure firmware to implement the
   power ops

presence of b. will be indicated by the psci device node in the device tree.
The device node is expected to be populated by the secure firmware if it
supports psci. If the native backend detects a psci node then it bails out
allowing the psci backend to be registered.

Also a dummy 'psci_probe' function is added for the case when psci support
is not included. This prevents the build from breaking for tc2 and the
rtsm platforms.

Signed-off-by: Achin Gupta <achin.gupta@arm.com>
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
arch/arm/include/asm/psci.h
arch/arm/kernel/psci.c

index 78ce38ff19f246d0e9c6693c6e24f8e40918755d..a079cbee427575c928a8a9d55962ad2cbe9818b4 100644 (file)
@@ -37,4 +37,12 @@ struct psci_operations {
 
 extern struct psci_operations psci_ops;
 
+#ifdef CONFIG_ARM_PSCI
+extern int __init psci_probe(void);
+#else
+static inline int psci_probe(void)
+{
+       return -ENODEV;
+}
+#endif
 #endif /* __ASM_ARM_PSCI_H */
index 5211f18cd2b4c95695cb9b1270f26e7e6b4f4833..03c10f65addef0f6182fc97b5cdd6f7d9fbf4cbc 100644 (file)
@@ -212,3 +212,16 @@ out_put_node:
        return 0;
 }
 early_initcall(psci_init);
+
+int __init psci_probe(void)
+{
+       struct device_node *np;
+       int ret = -ENODEV;
+
+       np = of_find_matching_node(NULL, psci_of_match);
+       if (np)
+               ret = 0;
+
+       of_node_put(np);
+       return ret;
+}