From patchwork Thu Jul 21 13:43:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 9241709 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CB3C9602F0 for ; Thu, 21 Jul 2016 13:46:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC9B6268AE for ; Thu, 21 Jul 2016 13:46:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B0F4127EED; Thu, 21 Jul 2016 13:46:23 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id DAA9B268AE for ; Thu, 21 Jul 2016 13:46:22 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bQEHU-0001jv-SO; Thu, 21 Jul 2016 13:44:52 +0000 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bQEHG-0001Zd-HT for linux-arm-kernel@lists.infradead.org; Thu, 21 Jul 2016 13:44:40 +0000 Received: by mail-pf0-x243.google.com with SMTP id g202so5526941pfb.1 for ; Thu, 21 Jul 2016 06:44:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jms.id.au; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=S0N9zgy3iEHCer9blipn/p4xQi4oU5PF14DPYl0HpE8=; b=X7IZA7mg48QK+HG1VSYdmsa+pWR4LtriXSTAlilj/z+ihnPMYB2HDZUcFXd3oBFHU0 lrwGX1ve5OJ7zrpuABzBLcbGkELDhE26zxNqyJYU++w+IAl24lJVdI3Hz1gekre+QT0M qFHiKRsYYc2CVqJwKv/y9c5O1/1MB2vRyHvzc= 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=S0N9zgy3iEHCer9blipn/p4xQi4oU5PF14DPYl0HpE8=; b=GMgP0L8T+OAuOUSQ0w2nYF52GZI3a1xNsCbgb59D3zO1qhvfr8hmkh/8q5hSx0TKRP HsgA0a0I14Znf+49zgWlplveA4T6BKcVvhUxWGm/ozzJmW+mjB8EVQUOPF4b1ECr0L9R e/k1SUR931PKWPGNYn1dFgJagQIGmgaZyrA3IHKvMaqHVWJsYw7ElXDLNYL+CLot7Tvz wY9sp+dKSv02/TD94e+es+87pvLOi3/i5UhCh44aW/nzPV6wjpIlr7stI1Q5xPW4Espp qgQF0Nm3lPnaJCbV2iqKIamKnOzoxyEn04F8RWwLOi+5dgkkPpDRO6a2e3KKiDTxXwrS HYPQ== X-Gm-Message-State: ALyK8tLQGYAUdN2e/TBMqM50CwsR7ps6N7vsvm8/U+hN/PkXDi3XovDsWib2zQ5wVtCH2Q== X-Received: by 10.98.6.132 with SMTP id 126mr73201493pfg.109.1469108658994; Thu, 21 Jul 2016 06:44:18 -0700 (PDT) Received: from aurora.ibm.com ([2403:480:11:8000:183:431c:1195:ed64]) by smtp.gmail.com with ESMTPSA id l82sm12623593pfk.8.2016.07.21.06.44.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Jul 2016 06:44:18 -0700 (PDT) From: Joel Stanley To: daniel.lezcano@linaro.org, tglx@linutronix.de, jonas.jensen@gmail.com Subject: [PATCH v2 1/3] drivers/clocksource/moxart: Refactor enable/disable Date: Thu, 21 Jul 2016 23:13:51 +0930 Message-Id: <1469108633-7940-2-git-send-email-joel@jms.id.au> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1469108633-7940-1-git-send-email-joel@jms.id.au> References: <1469108633-7940-1-git-send-email-joel@jms.id.au> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160721_064438_770747_6E353E8F X-CRM114-Status: GOOD ( 12.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, arnd@arndb.de, andrew@aj.id.au, benh@kernel.crashing.org, jk@ozlabs.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch abstracts the enable and disable register writes into their own functions in preparation for future changes to use SoC specific values for the writes. Signed-off-by: Joel Stanley --- drivers/clocksource/moxart_timer.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/drivers/clocksource/moxart_timer.c b/drivers/clocksource/moxart_timer.c index 841454417acd..a3aaa5658a49 100644 --- a/drivers/clocksource/moxart_timer.c +++ b/drivers/clocksource/moxart_timer.c @@ -58,15 +58,25 @@ static void __iomem *base; static unsigned int clock_count_per_tick; -static int moxart_shutdown(struct clock_event_device *evt) +static inline void moxart_disable(struct clock_event_device *evt) { writel(TIMER1_DISABLE, base + TIMER_CR); +} + +static inline void moxart_enable(struct clock_event_device *evt) +{ + writel(TIMER1_ENABLE, base + TIMER_CR); +} + +static int moxart_shutdown(struct clock_event_device *evt) +{ + moxart_disable(evt); return 0; } static int moxart_set_oneshot(struct clock_event_device *evt) { - writel(TIMER1_DISABLE, base + TIMER_CR); + moxart_disable(evt); writel(~0, base + TIMER1_BASE + REG_LOAD); return 0; } @@ -74,21 +84,21 @@ static int moxart_set_oneshot(struct clock_event_device *evt) static int moxart_set_periodic(struct clock_event_device *evt) { writel(clock_count_per_tick, base + TIMER1_BASE + REG_LOAD); - writel(TIMER1_ENABLE, base + TIMER_CR); + moxart_enable(evt); return 0; } static int moxart_clkevt_next_event(unsigned long cycles, - struct clock_event_device *unused) + struct clock_event_device *evt) { u32 u; - writel(TIMER1_DISABLE, base + TIMER_CR); + moxart_disable(evt); u = readl(base + TIMER1_BASE + REG_COUNT) - cycles; writel(u, base + TIMER1_BASE + REG_MATCH1); - writel(TIMER1_ENABLE, base + TIMER_CR); + moxart_enable(evt); return 0; }