From patchwork Mon Oct 5 09:50:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Gonzalez X-Patchwork-Id: 7325821 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B52169F2F7 for ; Mon, 5 Oct 2015 09:53:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D9CA12073E for ; Mon, 5 Oct 2015 09:53:18 +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 E161D20715 for ; Mon, 5 Oct 2015 09:53:17 +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 1Zj2Q4-0004hh-GG; Mon, 05 Oct 2015 09:50:56 +0000 Received: from mail1.bemta7.messagelabs.com ([216.82.254.110]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zj2Q2-0004Mj-3F for linux-arm-kernel@lists.infradead.org; Mon, 05 Oct 2015 09:50:54 +0000 Received: from [216.82.254.19] by server-14.bemta-7.messagelabs.com id FF/F0-30517-7E742165; Mon, 05 Oct 2015 09:50:31 +0000 X-Env-Sender: Marc_Gonzalez@sigmadesigns.com X-Msg-Ref: server-10.tower-96.messagelabs.com!1444038630!14696468!1 X-Originating-IP: [195.215.56.170] X-StarScan-Received: X-StarScan-Version: 6.13.16; banners=-,-,- X-VirusChecked: Checked Received: (qmail 23983 invoked from network); 5 Oct 2015 09:50:31 -0000 Received: from 195-215-56-170-static.dk.customer.tdc.net (HELO CPH-EX1.SDESIGNS.COM) (195.215.56.170) by server-10.tower-96.messagelabs.com with AES128-SHA encrypted SMTP; 5 Oct 2015 09:50:31 -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 11:50:28 +0200 Subject: [PATCH v3] twd: Don't set CLOCK_EVT_FEAT_C3STOP unconditionally To: Linus Walleij References: <56123BD0.8010005@sigmadesigns.com> <56124035.6080107@sigmadesigns.com> From: Marc Gonzalez Message-ID: <561247DF.1000308@sigmadesigns.com> Date: Mon, 5 Oct 2015 11:50:23 +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: X-Originating-IP: [172.27.0.114] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151005_025054_200942_5BFF785A X-CRM114-Status: GOOD ( 17.17 ) 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: Mark Rutland , Mans Rullgard , Russell King , Arnd Bergmann , Mason , Marc Zyngier , Catalin Marinas , 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 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 --- 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. + 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