From patchwork Tue Apr 29 13:17:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 29352 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f199.google.com (mail-yk0-f199.google.com [209.85.160.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 52D02202DD for ; Tue, 29 Apr 2014 13:17:55 +0000 (UTC) Received: by mail-yk0-f199.google.com with SMTP id 200sf368544ykr.6 for ; Tue, 29 Apr 2014 06:17:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=mxW4s4jum8bwcPNEFAAZBDSCRMnhCE3hJ7nDitmKuZg=; b=inVWQY6y0dGEJhVtEr18av/lhfer5t7KEXI4kNaC2od1r0AaCMRrtQQw1fGyhG+bm6 Ilr7UgqT63Yc6lulcWcr6skKTYE6I1AYYnCHrD0NNrIcGsGiJsJ4M9ll/9OS1OrKlPl1 ZozFGHwJAeadkr/KH5sx2Gz0SLR5m1Lu3no6Y490uNPXnZG99MaT5uPeqCQSzPVtjEWD dyvSRcWRElUtR6qjuqnW+bw4qxQOGZLY7rHG5VD5+cnuo9b+R4wN/T59PpxJk7UxKVD0 WQ1OznAjhdxE9I5pcNPVwm5ktW3zS1XvbRl6TmicSEb557pEuL28IvdlL4bqzlN2+S+Y tNdQ== X-Gm-Message-State: ALoCoQlvRA7wGUgl6gngV5HhgFUeJ0K9fN2t5ncpbJQm9x1VvS1XYMSZPaKgdmaf7RUG5bTQoWBR X-Received: by 10.236.142.101 with SMTP id h65mr13219568yhj.1.1398777475040; Tue, 29 Apr 2014 06:17:55 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.83.240 with SMTP id j103ls92959qgd.47.gmail; Tue, 29 Apr 2014 06:17:54 -0700 (PDT) X-Received: by 10.52.163.145 with SMTP id yi17mr236521vdb.46.1398777474828; Tue, 29 Apr 2014 06:17:54 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id sl10si1671555vdc.201.2014.04.29.06.17.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 29 Apr 2014 06:17:54 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id hq16so224315vcb.39 for ; Tue, 29 Apr 2014 06:17:54 -0700 (PDT) X-Received: by 10.220.7.131 with SMTP id d3mr183412vcd.45.1398777474737; Tue, 29 Apr 2014 06:17:54 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp196589vcb; Tue, 29 Apr 2014 06:17:54 -0700 (PDT) X-Received: by 10.50.62.104 with SMTP id x8mr253883igr.37.1398777474142; Tue, 29 Apr 2014 06:17:54 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bo3si15766260icc.82.2014.04.29.06.17.53; Tue, 29 Apr 2014 06:17:53 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757540AbaD2NRX (ORCPT + 28 others); Tue, 29 Apr 2014 09:17:23 -0400 Received: from mail-wi0-f175.google.com ([209.85.212.175]:37727 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757510AbaD2NRV (ORCPT ); Tue, 29 Apr 2014 09:17:21 -0400 Received: by mail-wi0-f175.google.com with SMTP id cc10so7379407wib.2 for ; Tue, 29 Apr 2014 06:17:19 -0700 (PDT) X-Received: by 10.180.78.5 with SMTP id x5mr20543641wiw.12.1398777439685; Tue, 29 Apr 2014 06:17:19 -0700 (PDT) Received: from localhost.localdomain (AToulouse-654-1-448-67.w83-205.abo.wanadoo.fr. [83.205.199.67]) by mx.google.com with ESMTPSA id dg7sm31091275wjc.4.2014.04.29.06.17.18 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 29 Apr 2014 06:17:18 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de, mingo@kernel.org Cc: Lorenzo.Pieralisi@arm.com, shc_work@mail.ru, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] clocksource: arch_arm_timer: Fix age-old arch timer C3STOP detection issue Date: Tue, 29 Apr 2014 15:17:19 +0200 Message-Id: <1398777440-12016-1-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <535FA618.6080101@linaro.org> References: <535FA618.6080101@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: daniel.lezcano@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Lorenzo Pieralisi ARM arch timers are tightly coupled with the CPU logic and lose context on platform implementing HW power management when cores are powered down at run-time. Marking the arch timers as C3STOP regardless of power management capabilities causes issues on platforms with no power management, since in that case the arch timers cannot possibly enter states where the timer loses context at runtime and therefore can always be used as a high resolution clockevent device. In order to fix the C3STOP issue in a way compliant with how real HW works, this patch adds a boolean property to the arch timer bindings to define if the arch timer is managed by an always-on power domain. This power domain is present on all ARM platforms to date, and manages HW that must not be turned off, whatever the state of other HW components (eg power controller). On platforms with no power management capabilities, it is the only power domain present, which encompasses and manages power supply for all HW components in the system. If the timer is powered by the always-on power domain, the always-on property must be present in the bindings which means that the timer cannot be shutdown at runtime, so it is not a C3STOP clockevent device. If the timer binding does not contain the always-on property, the timer is assumed to be power-gateable, hence it must be defined as a C3STOP clockevent device. Cc: Daniel Lezcano Cc: Magnus Damm Cc: Marc Carino Cc: Mark Rutland Acked-by: Marc Zyngier Acked-by: Rob Herring Signed-off-by: Lorenzo Pieralisi Signed-off-by: Daniel Lezcano --- .../devicetree/bindings/arm/arch_timer.txt | 3 +++ drivers/clocksource/arm_arch_timer.c | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/arm/arch_timer.txt b/Documentation/devicetree/bindings/arm/arch_timer.txt index 06fc760..37b2caf 100644 --- a/Documentation/devicetree/bindings/arm/arch_timer.txt +++ b/Documentation/devicetree/bindings/arm/arch_timer.txt @@ -19,6 +19,9 @@ to deliver its interrupts via SPIs. - clock-frequency : The frequency of the main counter, in Hz. Optional. +- always-on : a boolean property. If present, the timer is powered through an + always-on power domain, therefore it never loses context. + Example: timer { diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 57e823c..5163ec1 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -66,6 +66,7 @@ static int arch_timer_ppi[MAX_TIMER_PPI]; static struct clock_event_device __percpu *arch_timer_evt; static bool arch_timer_use_virtual = true; +static bool arch_timer_c3stop; static bool arch_timer_mem_use_virtual; /* @@ -263,7 +264,8 @@ static void __arch_timer_setup(unsigned type, clk->features = CLOCK_EVT_FEAT_ONESHOT; if (type == ARCH_CP15_TIMER) { - clk->features |= CLOCK_EVT_FEAT_C3STOP; + if (arch_timer_c3stop) + clk->features |= CLOCK_EVT_FEAT_C3STOP; clk->name = "arch_sys_timer"; clk->rating = 450; clk->cpumask = cpumask_of(smp_processor_id()); @@ -665,6 +667,8 @@ static void __init arch_timer_init(struct device_node *np) } } + arch_timer_c3stop = !of_property_read_bool(np, "always-on"); + arch_timer_register(); arch_timer_common_init(); }