aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-mvebu/pmsu.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c
index 7902d21d7d68..53a55c8520bf 100644
--- a/arch/arm/mach-mvebu/pmsu.c
+++ b/arch/arm/mach-mvebu/pmsu.c
@@ -23,6 +23,7 @@
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/of_address.h> 24#include <linux/of_address.h>
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/platform_device.h>
26#include <linux/smp.h> 27#include <linux/smp.h>
27#include <linux/resource.h> 28#include <linux/resource.h>
28#include <asm/cacheflush.h> 29#include <asm/cacheflush.h>
@@ -65,6 +66,10 @@ static void __iomem *pmsu_mp_base;
65extern void ll_disable_coherency(void); 66extern void ll_disable_coherency(void);
66extern void ll_enable_coherency(void); 67extern void ll_enable_coherency(void);
67 68
69static struct platform_device armada_xp_cpuidle_device = {
70 .name = "cpuidle-armada-370-xp",
71};
72
68static struct of_device_id of_pmsu_table[] = { 73static struct of_device_id of_pmsu_table[] = {
69 { .compatible = "marvell,armada-370-pmsu", }, 74 { .compatible = "marvell,armada-370-pmsu", },
70 { .compatible = "marvell,armada-370-xp-pmsu", }, 75 { .compatible = "marvell,armada-370-xp-pmsu", },
@@ -258,4 +263,36 @@ static struct notifier_block armada_370_xp_cpu_pm_notifier = {
258 .notifier_call = armada_370_xp_cpu_pm_notify, 263 .notifier_call = armada_370_xp_cpu_pm_notify,
259}; 264};
260 265
266int __init armada_370_xp_cpu_pm_init(void)
267{
268 struct device_node *np;
269
270 /*
271 * Check that all the requirements are available to enable
272 * cpuidle. So far, it is only supported on Armada XP, cpuidle
273 * needs the coherency fabric and the PMSU enabled
274 */
275
276 if (!of_machine_is_compatible("marvell,armadaxp"))
277 return 0;
278
279 np = of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric");
280 if (!np)
281 return 0;
282 of_node_put(np);
283
284 np = of_find_matching_node(NULL, of_pmsu_table);
285 if (!np)
286 return 0;
287 of_node_put(np);
288
289 armada_370_xp_pmsu_enable_l2_powerdown_onidle();
290 armada_xp_cpuidle_device.dev.platform_data = armada_370_xp_cpu_suspend;
291 platform_device_register(&armada_xp_cpuidle_device);
292 cpu_pm_register_notifier(&armada_370_xp_cpu_pm_notifier);
293
294 return 0;
295}
296
297arch_initcall(armada_370_xp_cpu_pm_init);
261early_initcall(armada_370_xp_pmsu_init); 298early_initcall(armada_370_xp_pmsu_init);