From patchwork Mon Oct 5 11:53:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Gonzalez X-Patchwork-Id: 7326931 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 32C11BEEA4 for ; Mon, 5 Oct 2015 11:56:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 50F8D20615 for ; Mon, 5 Oct 2015 11:56:04 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5327420611 for ; Mon, 5 Oct 2015 11:56:03 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zj4Ke-00011J-2l; Mon, 05 Oct 2015 11:53:28 +0000 Received: from mail1.bemta7.messagelabs.com ([216.82.254.101]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zj4Kb-0000sZ-5l for linux-arm-kernel@lists.infradead.org; Mon, 05 Oct 2015 11:53:25 +0000 Received: from [216.82.254.20] by server-5.bemta-7.messagelabs.com id 2A/02-03184-F9462165; Mon, 05 Oct 2015 11:53:03 +0000 X-Env-Sender: Marc_Gonzalez@sigmadesigns.com X-Msg-Ref: server-11.tower-47.messagelabs.com!1444045981!39405638!1 X-Originating-IP: [195.215.56.170] X-StarScan-Received: X-StarScan-Version: 6.13.16; banners=-,-,- X-VirusChecked: Checked Received: (qmail 21871 invoked from network); 5 Oct 2015 11:53:03 -0000 Received: from 195-215-56-170-static.dk.customer.tdc.net (HELO CPH-EX1.SDESIGNS.COM) (195.215.56.170) by server-11.tower-47.messagelabs.com with AES128-SHA encrypted SMTP; 5 Oct 2015 11:53:03 -0000 Received: from [172.27.0.114] (172.27.0.114) by CPH-EX1.sdesigns.com (192.168.10.36) with Microsoft SMTP Server (TLS) id 14.1.339.1; Mon, 5 Oct 2015 13:53:01 +0200 Subject: [PATCH v4] twd: Don't set CLOCK_EVT_FEAT_C3STOP unconditionally To: Mark Rutland References: <56123BD0.8010005@sigmadesigns.com> <56124035.6080107@sigmadesigns.com> <561247DF.1000308@sigmadesigns.com> <20151005103539.GC19064@leverpostej> From: Marc Gonzalez Message-ID: <5612649C.5020401@sigmadesigns.com> Date: Mon, 5 Oct 2015 13:53:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0 SeaMonkey/2.35 MIME-Version: 1.0 In-Reply-To: <20151005103539.GC19064@leverpostej> X-Originating-IP: [172.27.0.114] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151005_045325_259445_6CE2B8CE X-CRM114-Status: GOOD ( 16.89 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mans Rullgard , Russell King , Arnd Bergmann , Mason , Marc Zyngier , Catalin Marinas , Linus Walleij , Stephen Boyd , Felipe Balbi , Thomas Gleixner , Shawn Guo , Linux ARM Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 "twd-never-stops" boolean property, and set the CLOCK_EVT_FEAT_C3STOP flag accordingly. Signed-off-by: Marc Gonzalez Acked-by: Mark Rutland Acked-by: is often used by the maintainer of the affected code when that Acked-by: is not as formal as Signed-off-by:. It is a record that the acker Acked-by: does not necessarily indicate acknowledgement of the entire patch. Acked-by: [...] is a record that the acker has at least Reviewed-by: indicates that the patch has been reviewed and --- Documentation/devicetree/bindings/arm/twd.txt | 4 ++++ arch/arm/kernel/smp_twd.c | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/arm/twd.txt b/Documentation/devicetree/bindings/arm/twd.txt index 75b8610939fa..700a517b000e 100644 --- a/Documentation/devicetree/bindings/arm/twd.txt +++ b/Documentation/devicetree/bindings/arm/twd.txt @@ -19,6 +19,10 @@ interrupts. - reg : Specify the base address and the size of the TWD timer register window. +Optional +- twd-never-stops : boolean property. If present, TWD timers are expected + to keep generating interrupts, even when the CPU is in low-power mode. + Example: twd-timer@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