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: 7439831 Return-Path: X-Original-To: patchwork-linux-mediatek@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 399A19F52D for ; Mon, 19 Oct 2015 21:00:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1B155206EF for ; Mon, 19 Oct 2015 21:00:29 +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 264B9206E8 for ; Mon, 19 Oct 2015 21:00:28 +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 1ZoHXf-0007ZU-PZ; Mon, 19 Oct 2015 21:00:27 +0000 Received: from mail-wi0-f181.google.com ([209.85.212.181]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZoHXW-0006I7-SV for linux-mediatek@lists.infradead.org; Mon, 19 Oct 2015 21:00:19 +0000 Received: by wijp11 with SMTP id p11so18142045wij.0 for ; Mon, 19 Oct 2015 13:59:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YotjkrGlYCL/d1B2/jHifX1vYHX0fvoXD7dpKpAAZ8Y=; b=TB/MNf1RpfrtPNfc4xGWY+L4PCBDfHwGpF2b2cXw1YEYQOCnwpKW7SG8Vu2WvObK0t leJdam1StDDIpMCn/n5rj8u232UrNONwBGfwb4F4ctBbqSei1ToQtr5vAYCWBwd9MlBI I7GmGnjpYgg04Sv0BlHRgnv/zd1KgZY/r0z7AuY30ewckghdX6QoMZpUHkQjbL4/QsrQ 4kRySb4+JrVLZ3NmpUPSSOhDo9D4iH2BwpjLlwXtqtfXqRED1oqblZiOfODwlxoAJtAe Assxt7EvtQwAiEzXMUqMn0MM+nhEkzLI6TLsvc8dzWOpFQX3xbSYNFdLFWNKMuZQudG1 WZpQ== X-Gm-Message-State: ALoCoQnFQ5sWavyKLLbbwtccQAJbJ1BUYlPH0aEvMntpEcyoMHWtxB21qD8kwACkHMz6cltSh8/z 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151019_140019_154995_1307B0CE X-CRM114-Status: GOOD ( 11.62 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stephen Boyd , linux-kernel@vger.kernel.org, "moderated list:ARM/Mediatek SoC..." , Matthias Brugger , Yingjoe Chen , mingo@kernel.org, "moderated list:ARM/Mediatek SoC..." MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 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);