From patchwork Sun Feb 10 22:51:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stuart Menefy X-Patchwork-Id: 10804959 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 60C3114E1 for ; Sun, 10 Feb 2019 22:51:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5163B29BA7 for ; Sun, 10 Feb 2019 22:51:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 454FC29BAB; Sun, 10 Feb 2019 22:51:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC0F529BA7 for ; Sun, 10 Feb 2019 22:51:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726663AbfBJWvV (ORCPT ); Sun, 10 Feb 2019 17:51:21 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:36966 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbfBJWvU (ORCPT ); Sun, 10 Feb 2019 17:51:20 -0500 Received: by mail-wm1-f66.google.com with SMTP id x10so8086630wmg.2 for ; Sun, 10 Feb 2019 14:51:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mathembedded-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nIdxf4j3KnD7oNy9LuC6ROOVelJxc6kOF3KEKzbbZsk=; b=FQN9DBH3yJUGgHit/7Gs31JZ6yXI7evBdhm03ZWaTwBWiuM7qP+xUFJ3h4NCV6s70h Fm2Y1411mgMAf0ZyaupkxkYX+caDJWRkp605wqPXpqfoXWmZsMsJkvgGCev7w6ABkOt4 BG0BykM9ueNXygRr5Yv/ErIG39yRQSVJWLqOcpX++zbXr3QK3XCCcZ5BQ78rmpcSoGuW OmgmHRw1uKGcyU/ZIu4BcSPYBtbd9wX1u+6pyKJGaAWtRRoEbEzyC3a7E3beXezqyCXc D3MXOP+VQpjrRt5dwbMSI35madC+42o6Ua+Jzbfv5lsrQEYKOfpA9bNbcO6t/EbZkGVn GnRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nIdxf4j3KnD7oNy9LuC6ROOVelJxc6kOF3KEKzbbZsk=; b=sQC8yetk5APlw7ItM75GKaB8iqt8eZhLT8xIx5YydNmcWWITu42RA9rFilht+NBlyD bc2PqcGUvwqP4CKrOKnJkK1im6iYi/IHEAc1HFatZx2pRYLJKH8yg/vQKSu/jyvrNsQG Weosa4p8TkKI2w2VCqRc6n/lb975fhJzypnGkLzg75K7z2hAQ5hvMarTtpso5jBl08+p SF2PIEbt2DN7cWctpHXlICa5Ycxe7eHdEWUSSeGWwc69AOQCdlZFfvuo4F6AhbssakQO e9WhUQYwhkYUi+ISiPEfkOFvIw9TIHOutx0JLW5S4qVHMwyFfADunQJ6Z8gLP34sFKAJ JOxw== X-Gm-Message-State: AHQUAuZmJsSCzqWU2aV0bKg7BHc3WaDM0Uo2mBtm2TKOwYE9cq5xmC1J wgkQeavck4R9nVSX405t0ErRgHmTnkw/J/Ov X-Google-Smtp-Source: AHgI3IYF7h43g1CP/CDeb8vtCTWWwEjXO0VVxxT/wv42bMeamEthbEwi9vSE+7xxgm+u02hIU/H6cQ== X-Received: by 2002:adf:f84f:: with SMTP id d15mr20116413wrq.161.1549839079055; Sun, 10 Feb 2019 14:51:19 -0800 (PST) Received: from localhost.localdomain (host86-176-243-198.range86-176.btcentralplus.com. [86.176.243.198]) by smtp.gmail.com with ESMTPSA id c139sm3904325wmd.13.2019.02.10.14.51.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 10 Feb 2019 14:51:18 -0800 (PST) From: Stuart Menefy To: linux-samsung-soc@vger.kernel.org, Daniel Lezcano , Thomas Gleixner , Kukjin Kim , Krzysztof Kozlowski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Stuart Menefy Subject: [PATCH 1/2] clocksource: exynos_mct: Move one-shot check from tick clear to ISR Date: Sun, 10 Feb 2019 22:51:13 +0000 Message-Id: <20190210225114.20110-2-stuart.menefy@mathembedded.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20190210225114.20110-1-stuart.menefy@mathembedded.com> References: <20190210225114.20110-1-stuart.menefy@mathembedded.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When a timer tick occurs and the clock is in one-shot mode, the timer needs to be stopped to prevent it triggering subsequent interrupts. Currently this code is in exynos4_mct_tick_clear(), but as it is only needed when an ISR occurs move it into exynos4_mct_tick_isr(), leaving exynos4_mct_tick_clear() just doing what its name suggests it should. Signed-off-by: Stuart Menefy Reviewed-by: Krzysztof Kozlowski --- drivers/clocksource/exynos_mct.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c index 7a244b681876..1e325f89d408 100644 --- a/drivers/clocksource/exynos_mct.c +++ b/drivers/clocksource/exynos_mct.c @@ -388,6 +388,13 @@ static void exynos4_mct_tick_start(unsigned long cycles, exynos4_mct_write(tmp, mevt->base + MCT_L_TCON_OFFSET); } +static void exynos4_mct_tick_clear(struct mct_clock_event_device *mevt) +{ + /* Clear the MCT tick interrupt */ + if (readl_relaxed(reg_base + mevt->base + MCT_L_INT_CSTAT_OFFSET) & 1) + exynos4_mct_write(0x1, mevt->base + MCT_L_INT_CSTAT_OFFSET); +} + static int exynos4_tick_set_next_event(unsigned long cycles, struct clock_event_device *evt) { @@ -420,8 +427,11 @@ static int set_state_periodic(struct clock_event_device *evt) return 0; } -static void exynos4_mct_tick_clear(struct mct_clock_event_device *mevt) +static irqreturn_t exynos4_mct_tick_isr(int irq, void *dev_id) { + struct mct_clock_event_device *mevt = dev_id; + struct clock_event_device *evt = &mevt->evt; + /* * This is for supporting oneshot mode. * Mct would generate interrupt periodically @@ -430,16 +440,6 @@ static void exynos4_mct_tick_clear(struct mct_clock_event_device *mevt) if (!clockevent_state_periodic(&mevt->evt)) exynos4_mct_tick_stop(mevt); - /* Clear the MCT tick interrupt */ - if (readl_relaxed(reg_base + mevt->base + MCT_L_INT_CSTAT_OFFSET) & 1) - exynos4_mct_write(0x1, mevt->base + MCT_L_INT_CSTAT_OFFSET); -} - -static irqreturn_t exynos4_mct_tick_isr(int irq, void *dev_id) -{ - struct mct_clock_event_device *mevt = dev_id; - struct clock_event_device *evt = &mevt->evt; - exynos4_mct_tick_clear(mevt); evt->event_handler(evt); From patchwork Sun Feb 10 22:51:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stuart Menefy X-Patchwork-Id: 10804961 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7CC0717E6 for ; Sun, 10 Feb 2019 22:51:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CB6829BA7 for ; Sun, 10 Feb 2019 22:51:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 554F729BAC; Sun, 10 Feb 2019 22:51:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0869729BA8 for ; Sun, 10 Feb 2019 22:51:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726101AbfBJWvX (ORCPT ); Sun, 10 Feb 2019 17:51:23 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:50276 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726655AbfBJWvW (ORCPT ); Sun, 10 Feb 2019 17:51:22 -0500 Received: by mail-wm1-f67.google.com with SMTP id z5so13941978wmf.0 for ; Sun, 10 Feb 2019 14:51:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mathembedded-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UxJjrGC7S8wuLmEIVFRAlM1pKLfRQfIve9rD0DYFhcM=; b=poEtcwpA4f2mQKs6qAiivo18iaDEe7zxRU2bldCaLMf7lll0XSdV8/R4+SElYbzZtW 5BRKDLmv64DKuYZbay9tKh1PtL0Vlu2IaR3alSYTR7FFv7/gLpHzrbo1qkVIPewwQ9q0 vpqh/FZ6uMCiCKRXtRq9n2IUtKGpwq6258H2lomwZphLeqQT8zykHM56cj/fg+KiZZ3U iXZKxX1klaswCvgYcApmrli2Iu+kPjvajjjWP4JogvJsgmv7lmb6qThWJgGeJEnBeVq1 wBPeIC9gaqZ+GkmjfPa19skmU5GHkKPBs5v+7o2t3btTsg30yuVY7sKTTXRhwuydTR46 0rRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UxJjrGC7S8wuLmEIVFRAlM1pKLfRQfIve9rD0DYFhcM=; b=ak3xuFt2ZBC2sOFLVvw6omIekBA8nQO2lME2WLtTz03R4VOLJTNdLZ6iPFpAhbpgfy PIlzzpcg+kRBV8p4oFFMErzHsA8YP0zf4jVUHnk5CHHsMlq2XCwr3+yOe+agD03gw4A0 e6HGmJj9H2R8a5nvAHfciHUnLJtUdrr9Y1UtY3cC+ykesj0EXtLZH9US9LodcW/SaeNZ s+2WWq4mokrVr9OH0E++e4nzRxz74ZWzl33SeTbdisgnFLMxwh1TDMLKPLizJx2lT8HI L2fFRIwv+11nzW8nMsipD2Vb/PkGA/zk6gTm+fArvPdLpgmYdxs34Bw9Yf3fuffFXTkk 3cjA== X-Gm-Message-State: AHQUAubZDfsVNbfiIAU2xOjfPWqt7YDVojmm+1elJK41NE4UB8q0jY/Y h08FKVR8f/ulcl77TFHMMa+3gdI9yY3K5b2E X-Google-Smtp-Source: AHgI3IZectTBQRReNF8QKgvrBqrQimO7K4hqtf8S/K3t9zoe0a17CHmZfN+pasIL1lTb4VJZ8LxJgA== X-Received: by 2002:a5d:44d1:: with SMTP id z17mr20533185wrr.271.1549839080355; Sun, 10 Feb 2019 14:51:20 -0800 (PST) Received: from localhost.localdomain (host86-176-243-198.range86-176.btcentralplus.com. [86.176.243.198]) by smtp.gmail.com with ESMTPSA id c139sm3904325wmd.13.2019.02.10.14.51.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 10 Feb 2019 14:51:19 -0800 (PST) From: Stuart Menefy To: linux-samsung-soc@vger.kernel.org, Daniel Lezcano , Thomas Gleixner , Kukjin Kim , Krzysztof Kozlowski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Stuart Menefy Subject: [PATCH 2/2] clocksource: exynos_mct: Clear timer interrupt when shutdown Date: Sun, 10 Feb 2019 22:51:14 +0000 Message-Id: <20190210225114.20110-3-stuart.menefy@mathembedded.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20190210225114.20110-1-stuart.menefy@mathembedded.com> References: <20190210225114.20110-1-stuart.menefy@mathembedded.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When shutting down the timer, ensure that after we have stopped the timer any pending interrupts are cleared. This fixes a problem when suspending, as interrupts are disabled before the timer is stopped, so the timer interrupt may still be asserted, preventing the system entering a low power state when the wfi is executed. Signed-off-by: Stuart Menefy Reviewed-by: Krzysztof Kozlowski --- drivers/clocksource/exynos_mct.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c index 1e325f89d408..d55c30f6981d 100644 --- a/drivers/clocksource/exynos_mct.c +++ b/drivers/clocksource/exynos_mct.c @@ -411,6 +411,7 @@ static int set_state_shutdown(struct clock_event_device *evt) mevt = container_of(evt, struct mct_clock_event_device, evt); exynos4_mct_tick_stop(mevt); + exynos4_mct_tick_clear(mevt); return 0; }