Commit 8c16babc authored by Gregory CLEMENT's avatar Gregory CLEMENT Committed by Jason Cooper

ARM: mvebu: register the cpuidle driver for the Armada XP SoCs

The cpuidle is a platform driver so we register the device just after
the initialization of the board in an arch_initcall.
Signed-off-by: default avatarGregory CLEMENT <gregory.clement@free-electrons.com>
Link: https://lkml.kernel.org/r/1397488214-20685-12-git-send-email-gregory.clement@free-electrons.comSigned-off-by: default avatarJason Cooper <jason@lakedaemon.net>
parent b858fbc1
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/platform_device.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/resource.h> #include <linux/resource.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
...@@ -65,6 +66,10 @@ static void __iomem *pmsu_mp_base; ...@@ -65,6 +66,10 @@ static void __iomem *pmsu_mp_base;
extern void ll_disable_coherency(void); extern void ll_disable_coherency(void);
extern void ll_enable_coherency(void); extern void ll_enable_coherency(void);
static struct platform_device armada_xp_cpuidle_device = {
.name = "cpuidle-armada-370-xp",
};
static struct of_device_id of_pmsu_table[] = { static struct of_device_id of_pmsu_table[] = {
{ .compatible = "marvell,armada-370-pmsu", }, { .compatible = "marvell,armada-370-pmsu", },
{ .compatible = "marvell,armada-370-xp-pmsu", }, { .compatible = "marvell,armada-370-xp-pmsu", },
...@@ -258,4 +263,36 @@ static struct notifier_block armada_370_xp_cpu_pm_notifier = { ...@@ -258,4 +263,36 @@ static struct notifier_block armada_370_xp_cpu_pm_notifier = {
.notifier_call = armada_370_xp_cpu_pm_notify, .notifier_call = armada_370_xp_cpu_pm_notify,
}; };
int __init armada_370_xp_cpu_pm_init(void)
{
struct device_node *np;
/*
* Check that all the requirements are available to enable
* cpuidle. So far, it is only supported on Armada XP, cpuidle
* needs the coherency fabric and the PMSU enabled
*/
if (!of_machine_is_compatible("marvell,armadaxp"))
return 0;
np = of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric");
if (!np)
return 0;
of_node_put(np);
np = of_find_matching_node(NULL, of_pmsu_table);
if (!np)
return 0;
of_node_put(np);
armada_370_xp_pmsu_enable_l2_powerdown_onidle();
armada_xp_cpuidle_device.dev.platform_data = armada_370_xp_cpu_suspend;
platform_device_register(&armada_xp_cpuidle_device);
cpu_pm_register_notifier(&armada_370_xp_cpu_pm_notifier);
return 0;
}
arch_initcall(armada_370_xp_cpu_pm_init);
early_initcall(armada_370_xp_pmsu_init); early_initcall(armada_370_xp_pmsu_init);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment