]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ARM: 8441/2: twd: Don't set CLOCK_EVT_FEAT_C3STOP unconditionally
authorMarc Gonzalez <marc_gonzalez@sigmadesigns.com>
Fri, 9 Oct 2015 09:20:47 +0000 (10:20 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 9 Oct 2015 15:22:53 +0000 (16:22 +0100)
In 5388a6b266 ("ARM: SMP: Always enable clock event broadcast support")
Russell noted that "the TWD local timers are unable to wake up the CPU
when it is placed into a low power mode".

However, some platforms do not stop the TWD block in low-power mode,
and can thus use the TWD timer in one-shot mode, without setting up
a broadcast device.

Make the driver check for the "always-on" boolean property, and set
the CLOCK_EVT_FEAT_C3STOP flag accordingly.

Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Documentation/devicetree/bindings/arm/twd.txt
arch/arm/kernel/smp_twd.c

index 75b8610939faf819100c1e4fc7089b8542b753a2..383ea19c2bf0073e3a09ec4c254db28f17f28738 100644 (file)
@@ -19,6 +19,11 @@ interrupts.
 - reg : Specify the base address and the size of the TWD timer
        register window.
 
+Optional
+
+- always-on : a boolean property. If present, the timer is powered through
+  an always-on power domain, therefore it never loses context.
+
 Example:
 
        twd-timer@2c000600 {
index 662ed88bc1f949581a01c17a82f7375fca5d53a0..4c1aa61149bbc14eb2258b4de60a97989d450cc2 100644 (file)
@@ -33,6 +33,7 @@ static unsigned long twd_timer_rate;
 static DEFINE_PER_CPU(bool, percpu_setup_called);
 
 static struct clock_event_device __percpu *twd_evt;
+static int feat_c3stop;
 static int twd_ppi;
 
 static int twd_shutdown(struct clock_event_device *clk)
@@ -294,7 +295,7 @@ static void twd_timer_setup(void)
 
        clk->name = "local_timer";
        clk->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT |
-                       CLOCK_EVT_FEAT_C3STOP;
+                       feat_c3stop;
        clk->rating = 350;
        clk->set_state_shutdown = twd_shutdown;
        clk->set_state_periodic = twd_set_periodic;
@@ -349,6 +350,8 @@ static int __init twd_local_timer_common_register(struct device_node *np)
                goto out_irq;
 
        twd_get_clock(np);
+       if (!of_property_read_bool(np, "always-on"))
+               feat_c3stop = CLOCK_EVT_FEAT_C3STOP;
 
        /*
         * Immediately configure the timer on the boot CPU, unless we need