From patchwork Thu Nov 12 18:40:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 56460 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp584394lbb; Thu, 12 Nov 2015 10:42:24 -0800 (PST) X-Received: by 10.68.218.227 with SMTP id pj3mr24837680pbc.37.1447353744515; Thu, 12 Nov 2015 10:42:24 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id bv3si21465488pbd.105.2015.11.12.10.42.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Nov 2015 10:42:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com 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 1Zwwnl-0007Ue-Sl; Thu, 12 Nov 2015 18:40:53 +0000 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zwwni-0007Q4-3F for linux-arm-kernel@lists.infradead.org; Thu, 12 Nov 2015 18:40:50 +0000 Received: by wmww144 with SMTP id w144so101344094wmw.0 for ; Thu, 12 Nov 2015 10:40:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=oT36qyIKnwtsKhsuga+GfbGQiejSVhBEqzYIXa6GdAM=; b=ItTpxeYVjVzoMgdPmNZuCtwMt9bnOLc7p551k+yZQidFH79//of2bYeeLzr/obh7cB sPLE16bls/zgDt841MqdJ3KO1OaVmyFPWI19faEZymWPR/nntmJtiHCjY6LBhYf/mVOd 44CNRzj34FGtTa2WcDxAUD0CCshbHbv2KNqDiJt6APt9zsRCpy9VDdzQhq43WZLoBmIm vUGEocFnXjOf2GHCYXP0DogTK41T9UTMz2KBc0WQJr42EapAeMTmTdMcPJBbQJcxrEP8 nxx++jYZirTKkNS0whPCNM9w8H6NxiiWTzMcwkeTiw8ZDjKH4lMcdu6pcRPQ5/Q0jAjp Q0Bg== 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; bh=oT36qyIKnwtsKhsuga+GfbGQiejSVhBEqzYIXa6GdAM=; b=YQYj7SoCggI5TDs7tNdRnnynzbUlgZ0uDE8cTLMf1+FIxq4AFt1zGiSo6bJDs58XBY pWQ9dr5y471Mwy69xVfXqI2YSqdBBd5cKGNT03utSGSDzjyxpfSKLd8E2TFsmDbs6XFl weEFkXLid0PI0lToy3bxZ1OIoFMAlJME3AwmLwPzEz30iWivz871Va557KspTBaS6We0 ImT6BHTMau17SL7RNO7DXNkYmMHgdR6uyP2nZJEuAC1ZPGj9chXyobWTCu5u4pjhXMCT KOFacE+7ZImOdFkWLQpySiHvqwFc6FE5IOo6IWPGK6NeyAGj7OFVOQ2vsv3VfQFkPU/Z sEMA== X-Gm-Message-State: ALoCoQlgCQvZTOgsSgttVnzFuh0pZERIilNMsXciPyt2CocHH9tN7EnhtBZOOmvgjmMpjv+/wsMq X-Received: by 10.28.0.149 with SMTP id 143mr15696020wma.103.1447353628851; Thu, 12 Nov 2015 10:40:28 -0800 (PST) Received: from localhost.localdomain (sju31-1-78-210-255-2.fbx.proxad.net. [78.210.255.2]) by smtp.gmail.com with ESMTPSA id b134sm32084514wmf.9.2015.11.12.10.40.27 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Nov 2015 10:40:28 -0800 (PST) From: Daniel Lezcano To: daniel.lezcano@linaro.org Subject: [PATCH V2] clocksource/drivers/timer_sun5i: Replace code by clocksource_mmio_init Date: Thu, 12 Nov 2015 19:40:13 +0100 Message-Id: <1447353613-18778-1-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151112_104050_286655_1A777B66 X-CRM114-Status: GOOD ( 12.98 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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: "moderated list:ARM/Allwinner A1X..." , tglx@linutronix.de, linux-kernel@vger.kernel.org, Maxime Ripard MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org The current code to initialize, register and read the clocksource is already factored out in mmio.c via the clocksource_mmio_init function. The only difference is the readl vs readl_relaxed. Factor out the code with the clocksource_mmio_init function. Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-sun5i.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) -- 1.9.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/drivers/clocksource/timer-sun5i.c b/drivers/clocksource/timer-sun5i.c index bca9573..55d7258 100644 --- a/drivers/clocksource/timer-sun5i.c +++ b/drivers/clocksource/timer-sun5i.c @@ -152,13 +152,6 @@ static irqreturn_t sun5i_timer_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } -static cycle_t sun5i_clksrc_read(struct clocksource *clksrc) -{ - struct sun5i_timer_clksrc *cs = to_sun5i_timer_clksrc(clksrc); - - return ~readl(cs->timer.base + TIMER_CNTVAL_LO_REG(1)); -} - static int sun5i_rate_cb_clksrc(struct notifier_block *nb, unsigned long event, void *data) { @@ -217,13 +210,8 @@ static int __init sun5i_setup_clocksource(struct device_node *node, writel(TIMER_CTL_ENABLE | TIMER_CTL_RELOAD, base + TIMER_CTL_REG(1)); - cs->clksrc.name = node->name; - cs->clksrc.rating = 340; - cs->clksrc.read = sun5i_clksrc_read; - cs->clksrc.mask = CLOCKSOURCE_MASK(32); - cs->clksrc.flags = CLOCK_SOURCE_IS_CONTINUOUS; - - ret = clocksource_register_hz(&cs->clksrc, rate); + ret = clocksource_mmio_init(base + TIMER_CNTVAL_LO_REG(1), node->name, + rate, 340, UINT_MAX, clocksource_mmio_readl_down); if (ret) { pr_err("Couldn't register clock source.\n"); goto err_remove_notifier;