These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / arch / arm / mach-mvebu / pmsu.c
index 4f4e222..ed8fda4 100644 (file)
@@ -296,11 +296,11 @@ int armada_370_xp_pmsu_idle_enter(unsigned long deepidle)
        /* Test the CR_C bit and set it if it was cleared */
        asm volatile(
        "mrc    p15, 0, r0, c1, c0, 0 \n\t"
-       "tst    r0, #(1 << 2) \n\t"
+       "tst    r0, %0 \n\t"
        "orreq  r0, r0, #(1 << 2) \n\t"
        "mcreq  p15, 0, r0, c1, c0, 0 \n\t"
        "isb    "
-       : : : "r0");
+       : : "Ir" (CR_C) : "r0");
 
        pr_debug("Failed to suspend the system\n");
 
@@ -379,6 +379,16 @@ static struct notifier_block mvebu_v7_cpu_pm_notifier = {
 
 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)
 {
        struct device_node *np;
@@ -387,7 +397,9 @@ static __init int armada_370_cpuidle_init(void)
        np = of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric");
        if (!np)
                return -ENODEV;
-       of_node_put(np);
+
+       if (broken_idle(np))
+               goto end;
 
        /*
         * On Armada 370, there is "a slow exit process from the deep
@@ -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.name = "cpuidle-armada-370";
 
+end:
+       of_node_put(np);
        return 0;
 }
 
@@ -415,13 +429,17 @@ static __init int armada_38x_cpuidle_init(void)
        void __iomem *mpsoc_base;
        u32 reg;
 
-       pr_warn("CPU idle is currently broken on Armada 38x: disabling");
+       pr_warn("CPU idle is currently broken on Armada 38x: disabling\n");
        return 0;
 
        np = of_find_compatible_node(NULL, NULL,
                                     "marvell,armada-380-coherency-fabric");
        if (!np)
                return -ENODEV;
+
+       if (broken_idle(np))
+               goto end;
+
        of_node_put(np);
 
        np = of_find_compatible_node(NULL, NULL,
@@ -430,7 +448,6 @@ static __init int armada_38x_cpuidle_init(void)
                return -ENODEV;
        mpsoc_base = of_iomap(np, 0);
        BUG_ON(!mpsoc_base);
-       of_node_put(np);
 
        /* Set up reset mask when powering down the cpus */
        reg = readl(mpsoc_base + MPCORE_RESET_CTL);
@@ -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.name = "cpuidle-armada-38x";
 
+end:
+       of_node_put(np);
        return 0;
 }
 
@@ -460,12 +479,16 @@ static __init int armada_xp_cpuidle_init(void)
        np = of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric");
        if (!np)
                return -ENODEV;
-       of_node_put(np);
+
+       if (broken_idle(np))
+               goto end;
 
        mvebu_cpu_resume = armada_370_xp_cpu_resume;
        mvebu_v7_cpuidle_device.dev.platform_data = armada_370_xp_cpu_suspend;
        mvebu_v7_cpuidle_device.name = "cpuidle-armada-xp";
 
+end:
+       of_node_put(np);
        return 0;
 }
 
@@ -486,7 +509,7 @@ static int __init mvebu_v7_cpu_pm_init(void)
         */
        if (of_machine_is_compatible("marvell,armada380")) {
                cpu_hotplug_disable();
-               pr_warn("CPU hotplug support is currently broken on Armada 38x: disabling");
+               pr_warn("CPU hotplug support is currently broken on Armada 38x: disabling\n");
        }
 
        if (of_machine_is_compatible("marvell,armadaxp"))