From patchwork Mon Oct 19 20:59:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 55255 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id D454D22F11 for ; Mon, 19 Oct 2015 21:00:03 +0000 (UTC) Received: by wiclg3 with SMTP id lg3sf129438wic.3 for ; Mon, 19 Oct 2015 14:00:03 -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=QWs05l62fVt11Nr8Ts02xi/rX7e1L+OL8xd5vJtnlTw=; b=Mtfmqu/Gc+i+6OV5LSrbIqd9hwndlU1Z+J6jbyiyKK2BBD/rpu4/5wkov0yAkuTDNQ 6Cx2p2eV57ImIujjsC5+qh/OJVMTUZGloEakdRcFz4MtzZ/1Ge1uR0oSEKPTIbvXdKVb JqtAXQaGWCJ6BxMn3Y9R9qVJGaB3k9GfIyqYPHriMdzrB5Bn0QD5wUSG9yr+fgd09Vid J5fXPv8IE7bL5vSjtvkGqJggnbOfhMIKqVwaaWjN3mFTxhBTYPoXTzQk2iBrrLMxV6Er tA99LiXnqlOeE+zfH+deRzfUt5hGreFVZqUpW/HZZnw1ArWFv08a9ps5I37pMWOLohMD WDBA== X-Gm-Message-State: ALoCoQnLqKwC4a4634T+8h7DvfyTx5HtSbOFFBoBhD1rwruI2dTBUpnu+D9MhHXS5p9Q9rnIq5oq X-Received: by 10.180.160.194 with SMTP id xm2mr2305623wib.6.1445288403123; Mon, 19 Oct 2015 14:00:03 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.87.137 with SMTP id l131ls5180lfb.80.gmail; Mon, 19 Oct 2015 14:00:02 -0700 (PDT) X-Received: by 10.25.21.26 with SMTP id l26mr7500432lfi.122.1445288402934; Mon, 19 Oct 2015 14:00:02 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id m188si24305405lfe.38.2015.10.19.14.00.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Oct 2015 14:00:02 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbbwb3 with SMTP id wb3so95842977lbb.1 for ; Mon, 19 Oct 2015 14:00:02 -0700 (PDT) X-Received: by 10.112.17.34 with SMTP id l2mr15752777lbd.117.1445288402729; Mon, 19 Oct 2015 14:00:02 -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.112.59.35 with SMTP id w3csp1696794lbq; Mon, 19 Oct 2015 14:00:01 -0700 (PDT) X-Received: by 10.68.212.197 with SMTP id nm5mr2897303pbc.108.1445288401637; Mon, 19 Oct 2015 14:00:01 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xg5si55330355pab.13.2015.10.19.14.00.01; Mon, 19 Oct 2015 14:00:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753959AbbJSU77 (ORCPT + 28 others); Mon, 19 Oct 2015 16:59:59 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:33813 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750814AbbJSU76 (ORCPT ); Mon, 19 Oct 2015 16:59:58 -0400 Received: by wikq8 with SMTP id q8so17396498wik.1 for ; Mon, 19 Oct 2015 13:59:57 -0700 (PDT) X-Received: by 10.195.13.164 with SMTP id ez4mr34587679wjd.112.1445288397175; Mon, 19 Oct 2015 13:59:57 -0700 (PDT) Received: from mai.telefonica.net (185.Red-213-96-199.staticIP.rima-tde.net. [213.96.199.185]) by smtp.gmail.com with ESMTPSA id xt1sm42296501wjb.32.2015.10.19.13.59.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Oct 2015 13:59:56 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, Yingjoe Chen , Stephen Boyd , Matthias Brugger , linux-arm-kernel@lists.infradead.org (moderated list:ARM/Mediatek SoC...), linux-mediatek@lists.infradead.org (moderated list:ARM/Mediatek SoC...) Subject: [PATCH 2/9] clocksource/drivers/mediatek: Use GPT as sched clock source Date: Mon, 19 Oct 2015 22:59:21 +0200 Message-Id: <1445288368-6440-2-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445288368-6440-1-git-send-email-daniel.lezcano@linaro.org> References: <56255943.6060807@linaro.org> <1445288368-6440-1-git-send-email-daniel.lezcano@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=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) smtp.mailfrom=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: Yingjoe Chen When cpu is in deep idle, arch timer will stop counting. Setup GPT as sched clock source so it can keep counting in idle. Signed-off-by: Yingjoe Chen Signed-off-by: Daniel Lezcano Acked-by: Stephen Boyd Acked-by: Matthias Brugger --- drivers/clocksource/mtk_timer.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c index c8badc4..fbfc746 100644 --- a/drivers/clocksource/mtk_timer.c +++ b/drivers/clocksource/mtk_timer.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #define GPT_IRQ_EN_REG 0x00 @@ -59,6 +60,13 @@ struct mtk_clock_event_device { struct clock_event_device dev; }; +static void __iomem *gpt_sched_reg __read_mostly; + +static u64 notrace mtk_read_sched_clock(void) +{ + return readl_relaxed(gpt_sched_reg); +} + static inline struct mtk_clock_event_device *to_mtk_clk( struct clock_event_device *c) { @@ -230,6 +238,8 @@ static void __init mtk_timer_init(struct device_node *node) mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN); clocksource_mmio_init(evt->gpt_base + TIMER_CNT_REG(GPT_CLK_SRC), node->name, rate, 300, 32, clocksource_mmio_readl_up); + gpt_sched_reg = evt->gpt_base + TIMER_CNT_REG(GPT_CLK_SRC); + sched_clock_register(mtk_read_sched_clock, 32, rate); /* Configure clock event */ mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT);