From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3] twd: Don't set CLOCK_EVT_FEAT_C3STOP unconditionally
Date: Mon, 5 Oct 2015 11:35:40 +0100 [thread overview]
Message-ID: <20151005103539.GC19064@leverpostej> (raw)
In-Reply-To: <561247DF.1000308@sigmadesigns.com>
On Mon, Oct 05, 2015 at 11:50:23AM +0200, Marc Gonzalez wrote:
> 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 timers in one-shot mode, without setting up
> a broadcast device.
>
> Make the driver check for the "twd_never_stops" property, and set the
> CLOCK_EVT_FEAT_C3STOP flag accordingly.
>
> Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
> ---
> Documentation/devicetree/bindings/arm/twd.txt | 5 +++++
> arch/arm/kernel/smp_twd.c | 5 ++++-
> 2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/arm/twd.txt b/Documentation/devicetree/bindings/arm/twd.txt
> index 75b8610939fa..7f849235e12a 100644
> --- a/Documentation/devicetree/bindings/arm/twd.txt
> +++ b/Documentation/devicetree/bindings/arm/twd.txt
> @@ -19,6 +19,11 @@ interrupts.
> - reg : Specify the base address and the size of the TWD timer
> register window.
>
> +Optional
> +- twd-never-stops : boolean property. If present, the twd driver will not set
> + the CLOCK_EVT_FEAT_C3STOP flag. TWD timer can then operate in one-shot mode,
> + no broadcast device required.
Please describe the actual physical details (i.e. that the TWD cannot be
placed into a state where it cannot generate interrupts) rather than
describing the Linux implementation details.
Otherwise this looks ok.
Mark.
> +
> Example:
>
> twd-timer at 2c000600 {
> diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
> index e8f6d241881f..79298d4fb41f 100644
> --- a/arch/arm/kernel/smp_twd.c
> +++ b/arch/arm/kernel/smp_twd.c
> @@ -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 void twd_set_mode(enum clock_event_mode mode,
> @@ -293,7 +294,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_mode = twd_set_mode;
> clk->set_next_event = twd_set_next_event;
> @@ -345,6 +346,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, "twd-never-stops"))
> + feat_c3stop = CLOCK_EVT_FEAT_C3STOP;
>
> /*
> * Immediately configure the timer on the boot CPU, unless we need
> --
> 2.4.5
>
next prev parent reply other threads:[~2015-10-05 10:35 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-05 8:58 [PATCH] twd: Don't set CLOCK_EVT_FEAT_C3STOP unconditionally Marc Gonzalez
2015-10-05 9:17 ` [PATCH v2] " Marc Gonzalez
2015-10-05 9:22 ` Linus Walleij
2015-10-05 9:50 ` [PATCH v3] " Marc Gonzalez
2015-10-05 10:35 ` Mark Rutland [this message]
2015-10-05 11:53 ` [PATCH v4] " Marc Gonzalez
2015-10-05 16:37 ` Marc Gonzalez
2015-10-07 12:14 ` Marc Gonzalez
2015-10-08 17:16 ` Mark Rutland
2015-10-08 17:38 ` Mason
2015-10-08 17:43 ` Russell King - ARM Linux
2015-10-08 18:16 ` Mason
2015-10-08 18:22 ` Russell King - ARM Linux
2015-10-08 18:37 ` Mason
2015-10-08 17:57 ` Mark Rutland
2015-10-08 18:25 ` Mason
2015-10-08 18:34 ` Mark Rutland
2015-10-09 9:29 ` Marc Gonzalez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151005103539.GC19064@leverpostej \
--to=mark.rutland@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.