From patchwork Tue Mar 2 07:28:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fengquan Chen X-Patchwork-Id: 12111045 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A00DC433DB for ; Tue, 2 Mar 2021 07:34:15 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4157760240 for ; Tue, 2 Mar 2021 07:34:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4157760240 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ThqQrfsiQ4kJzLgH5fNrkz9reaphMIMAZ8Dk6+B/Zv4=; b=reENmJZTOEcRfpRLTjWZK4HcI tGBSeii4AKIMEbgKY1+w5Hyj6J7yftE6MtD4hOI5pWw7M9hvKFFLFl4iQwUG97PivRYbux7aBk4Ks JqRzmzcxhc5YhfqUYNn7ccE8Zk4FekWH7q85EhZEvP32dc01UEkJnnw3TWBDtggGBevOaHj4cryTS LDr4kvDZQ2SezvQbd4p8fyfkPo2Jrme1QfCn4RlmS/DoHaG4nsqRcOJSHdMmMYXITjhSaV8i293WK Kil8QeQuS/N70YNcqMSlBGk9Ts5eW4zvdel80Koxtc14AEW1bcUf/qE8F6xZH/AufrydxW97lu0Kg 2EjIph+pg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lGzWg-00064J-BD; Tue, 02 Mar 2021 07:33:02 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lGzWc-00062i-3y; Tue, 02 Mar 2021 07:32:59 +0000 X-UUID: a86ebdd663fc4ad7acb76ee84795ed12-20210301 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=qBsh+qCJeFaaVUFsEnzMojxn589xljIGU6aFArByVhs=; b=ViM2YIErPSfTOFzDskO/4mIYPjXc0xN9KWRDuJMCNIHFSGvyvQrp/UX3TJeQa5q20Pk+6XjTxfLf5YkQi8IUnp0u/Uam1euZ+qSI9XPRUm7PMoiruxC9Tx8R98mEMcrd8aNJYKQqV3KQOeK/6TgrLJStJTB/g0Us3azUzDfEKf4=; X-UUID: a86ebdd663fc4ad7acb76ee84795ed12-20210301 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 857844676; Mon, 01 Mar 2021 23:28:38 -0800 Received: from MTKMBS31N1.mediatek.inc (172.27.4.69) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 1 Mar 2021 23:28:36 -0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by MTKMBS31N1.mediatek.inc (172.27.4.69) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 2 Mar 2021 15:28:33 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 2 Mar 2021 15:28:32 +0800 From: Fengquan Chen To: Daniel Lezcano , Thomas Gleixner , Matthias Brugger , , , Subject: [PATCH] clocksource/drivers/timer-mediatek: optimize systimer irq clear flow on Mediatek Socs Date: Tue, 2 Mar 2021 15:28:05 +0800 Message-ID: <1614670085-26229-2-git-send-email-Fengquan.Chen@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1614670085-26229-1-git-send-email-Fengquan.Chen@mediatek.com> References: <1614670085-26229-1-git-send-email-Fengquan.Chen@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: C6A9DD39B665283DEC9F409682BFD9C5E80DCE98BCB2721AA6A68ACDD4DE829B2000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210302_023258_340773_BB7DE6B9 X-CRM114-Status: GOOD ( 11.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fengquan Chen , dehui.sun@mediatek.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 1)ensure systimer is enabled before clear and disable interrupt, which only for systimer in Mediatek Socs. 2)clear any pending timer-irq when shutdown to keep suspend flow clean, when use systimer as tick-broadcast timer Change-Id: Ia3eda83324af2fdaf5cbb3569a9bf020a11f8009 Signed-off-by: Fengquan Chen --- drivers/clocksource/timer-mediatek.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/clocksource/timer-mediatek.c b/drivers/clocksource/timer-mediatek.c index 9318edc..9f1f095dc 100644 --- a/drivers/clocksource/timer-mediatek.c +++ b/drivers/clocksource/timer-mediatek.c @@ -75,6 +75,7 @@ static void mtk_syst_ack_irq(struct timer_of *to) { /* Clear and disable interrupt */ + writel(SYST_CON_EN, SYST_CON_REG(to)); writel(SYST_CON_IRQ_CLR | SYST_CON_EN, SYST_CON_REG(to)); } @@ -111,6 +112,9 @@ static int mtk_syst_clkevt_next_event(unsigned long ticks, static int mtk_syst_clkevt_shutdown(struct clock_event_device *clkevt) { + /* Clear any irq */ + mtk_syst_ack_irq(to_timer_of(clkevt)); + /* Disable timer */ writel(0, SYST_CON_REG(to_timer_of(clkevt)));