Commit 9d2ea95a authored by Vincent Donnefort's avatar Vincent Donnefort Committed by Gregory CLEMENT

ARM: mvebu: add broken-idle option

The broken-idle option can be activated from the coherency-fabric DT
node. This property allows to disable the idle capability, when the
hardware doesn't support it, like the Seagate Personal Cloud boards.
Signed-off-by: default avatarVincent Donnefort <vdonnefort@gmail.com>
Signed-off-by: default avatarGregory CLEMENT <gregory.clement@free-electrons.com>
parent 4904dbda
...@@ -27,6 +27,11 @@ Required properties: ...@@ -27,6 +27,11 @@ Required properties:
* For "marvell,armada-380-coherency-fabric", only one pair is needed * For "marvell,armada-380-coherency-fabric", only one pair is needed
for the per-CPU fabric registers. for the per-CPU fabric registers.
Optional properties:
- broken-idle: boolean to set when the Idle mode is not supported by the
hardware.
Examples: Examples:
coherency-fabric@d0020200 { coherency-fabric@d0020200 {
......
...@@ -379,6 +379,16 @@ static struct notifier_block mvebu_v7_cpu_pm_notifier = { ...@@ -379,6 +379,16 @@ static struct notifier_block mvebu_v7_cpu_pm_notifier = {
static struct platform_device mvebu_v7_cpuidle_device; static struct platform_device mvebu_v7_cpuidle_device;
static int broken_idle(struct device_node *np)
{
if (of_property_read_bool(np, "broken-idle")) {
pr_warn("CPU idle is currently broken: disabling\n");
return 1;
}
return 0;
}
static __init int armada_370_cpuidle_init(void) static __init int armada_370_cpuidle_init(void)
{ {
struct device_node *np; struct device_node *np;
...@@ -387,7 +397,9 @@ static __init int armada_370_cpuidle_init(void) ...@@ -387,7 +397,9 @@ static __init int armada_370_cpuidle_init(void)
np = of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric"); np = of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric");
if (!np) if (!np)
return -ENODEV; return -ENODEV;
of_node_put(np);
if (broken_idle(np))
goto end;
/* /*
* On Armada 370, there is "a slow exit process from the deep * On Armada 370, there is "a slow exit process from the deep
...@@ -406,6 +418,8 @@ static __init int armada_370_cpuidle_init(void) ...@@ -406,6 +418,8 @@ static __init int armada_370_cpuidle_init(void)
mvebu_v7_cpuidle_device.dev.platform_data = armada_370_xp_cpu_suspend; mvebu_v7_cpuidle_device.dev.platform_data = armada_370_xp_cpu_suspend;
mvebu_v7_cpuidle_device.name = "cpuidle-armada-370"; mvebu_v7_cpuidle_device.name = "cpuidle-armada-370";
end:
of_node_put(np);
return 0; return 0;
} }
...@@ -422,6 +436,10 @@ static __init int armada_38x_cpuidle_init(void) ...@@ -422,6 +436,10 @@ static __init int armada_38x_cpuidle_init(void)
"marvell,armada-380-coherency-fabric"); "marvell,armada-380-coherency-fabric");
if (!np) if (!np)
return -ENODEV; return -ENODEV;
if (broken_idle(np))
goto end;
of_node_put(np); of_node_put(np);
np = of_find_compatible_node(NULL, NULL, np = of_find_compatible_node(NULL, NULL,
...@@ -430,7 +448,6 @@ static __init int armada_38x_cpuidle_init(void) ...@@ -430,7 +448,6 @@ static __init int armada_38x_cpuidle_init(void)
return -ENODEV; return -ENODEV;
mpsoc_base = of_iomap(np, 0); mpsoc_base = of_iomap(np, 0);
BUG_ON(!mpsoc_base); BUG_ON(!mpsoc_base);
of_node_put(np);
/* Set up reset mask when powering down the cpus */ /* Set up reset mask when powering down the cpus */
reg = readl(mpsoc_base + MPCORE_RESET_CTL); reg = readl(mpsoc_base + MPCORE_RESET_CTL);
...@@ -450,6 +467,8 @@ static __init int armada_38x_cpuidle_init(void) ...@@ -450,6 +467,8 @@ static __init int armada_38x_cpuidle_init(void)
mvebu_v7_cpuidle_device.dev.platform_data = armada_38x_cpu_suspend; mvebu_v7_cpuidle_device.dev.platform_data = armada_38x_cpu_suspend;
mvebu_v7_cpuidle_device.name = "cpuidle-armada-38x"; mvebu_v7_cpuidle_device.name = "cpuidle-armada-38x";
end:
of_node_put(np);
return 0; return 0;
} }
...@@ -460,12 +479,16 @@ static __init int armada_xp_cpuidle_init(void) ...@@ -460,12 +479,16 @@ static __init int armada_xp_cpuidle_init(void)
np = of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric"); np = of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric");
if (!np) if (!np)
return -ENODEV; return -ENODEV;
of_node_put(np);
if (broken_idle(np))
goto end;
mvebu_cpu_resume = armada_370_xp_cpu_resume; mvebu_cpu_resume = armada_370_xp_cpu_resume;
mvebu_v7_cpuidle_device.dev.platform_data = armada_370_xp_cpu_suspend; mvebu_v7_cpuidle_device.dev.platform_data = armada_370_xp_cpu_suspend;
mvebu_v7_cpuidle_device.name = "cpuidle-armada-xp"; mvebu_v7_cpuidle_device.name = "cpuidle-armada-xp";
end:
of_node_put(np);
return 0; return 0;
} }
......
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