From patchwork Fri Nov 13 14:24:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 56519 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp1069276lbb; Fri, 13 Nov 2015 06:25:19 -0800 (PST) X-Received: by 10.66.148.67 with SMTP id tq3mr32305552pab.124.1447424719241; Fri, 13 Nov 2015 06:25:19 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id it8si27784317pbc.103.2015.11.13.06.25.18; Fri, 13 Nov 2015 06:25:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932548AbbKMOZQ (ORCPT + 28 others); Fri, 13 Nov 2015 09:25:16 -0500 Received: from mail-wm0-f42.google.com ([74.125.82.42]:37187 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932330AbbKMOZO (ORCPT ); Fri, 13 Nov 2015 09:25:14 -0500 Received: by wmww144 with SMTP id w144so32859001wmw.0 for ; Fri, 13 Nov 2015 06:25:13 -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=9pAqNkCIBw3ARTMNA2/zPYDdGvc9sLtpaRiAI1iwQlk=; b=URYPl56Qf1E4uxR34m36TV5b4TfEUlD6p1P+xN1ge/xqCS+jLe22cuxPmpRjVipk3p uPyV0ok6GxkhbhAPb9gtQVadbTmHfc1yBGuxFOoyJkVfgYGgjZRlvAL8WdX0A7DhXrQx U431MxbNKzvYZ4UfDv+TH+bkF24HO5kw4sVBSE/4IiNRFp9p1lXsRJ1fY8BWgWF+l73j ghKJtJMIIy/5i/npL+gw7QrCPiNySAjt/4aAXFFjvN4VFb578ZPMhx0A05BpcIIyFkQT sKsyUtkaklUB/O3XLu1dn0RSl80JwxQNYsx2KENztkxPd6bKWqihye0CdIMqUnpS/CVA YK8Q== 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=9pAqNkCIBw3ARTMNA2/zPYDdGvc9sLtpaRiAI1iwQlk=; b=Ado6vllqvybECIUhydPPxASdOrJbKC3p2eDsMxKt/B+yuEO8UQq9jGU8dOuCkuigtK /pruvTvjTfgluOTTv3CwQMApwcBewY7nIBCexGuXdlHok5PgyaqLoMMgxD0/zDieestg CXeXabaMg7h5ycvA1yfpFC3N8qtEhNbz+TUyUIWxxWQbpyMQf/cs4spSuMa0oO/096Wy OGdD7CNfl+Jg9WC8MQEqrrspngNlKmRgOMhhZu7Fm75tgwutzpx7Ksk0vGuNsXWi3Fo8 EqbK0g5WTMTuvJ8mrDo82s8lLIW5nmm5WSoDuFXwyQX9nUN2mcZ3gRp1yZqqLgLsxuDy 22Sg== X-Gm-Message-State: ALoCoQmOYIsIRf6I4ng8MVJkJUiEfLpjZrIyuYiJPYIM+mI9zDviOMS2JWjCgBc4KqfSRSq7wxoA X-Received: by 10.194.23.104 with SMTP id l8mr20787826wjf.132.1447424713298; Fri, 13 Nov 2015 06:25:13 -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 20sm4210994wmh.8.2015.11.13.06.25.12 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Nov 2015 06:25:12 -0800 (PST) From: Daniel Lezcano To: daniel.lezcano@linaro.org Cc: tglx@linutronix.de, marc_gonzalez@sigmadesigns.com, linux-kernel@vger.kernel.org Subject: [PATCH V2] clocksource/drivers/tango-xtal: Replace code by clocksource_mmio_init Date: Fri, 13 Nov 2015 15:24:51 +0100 Message-Id: <1447424691-4767-1-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current code to initialize, register and read the clocksource is already factored out in mmio.c via the clocksource_mmio_init function. Factor out the code with the clocksource_mmio_init function. Signed-off-by: Daniel Lezcano --- drivers/clocksource/Kconfig | 1 + drivers/clocksource/tango_xtal.c | 18 +++--------------- 2 files changed, 4 insertions(+), 15 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index ecf9855..6969696 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -333,6 +333,7 @@ config CLKSRC_TANGO_XTAL bool "Clocksource for Tango SoC" if COMPILE_TEST depends on ARM select CLKSRC_OF + select CLKSRC_MMIO help This enables the clocksource for Tango SoC diff --git a/drivers/clocksource/tango_xtal.c b/drivers/clocksource/tango_xtal.c index d297b30..2bcecaf 100644 --- a/drivers/clocksource/tango_xtal.c +++ b/drivers/clocksource/tango_xtal.c @@ -19,19 +19,6 @@ static u64 notrace read_sched_clock(void) return read_xtal_counter(); } -static cycle_t read_clocksource(struct clocksource *cs) -{ - return read_xtal_counter(); -} - -static struct clocksource tango_xtal = { - .name = "tango-xtal", - .rating = 350, - .read = read_clocksource, - .mask = CLOCKSOURCE_MASK(32), - .flags = CLOCK_SOURCE_IS_CONTINUOUS, -}; - static void __init tango_clocksource_init(struct device_node *np) { struct clk *clk; @@ -53,8 +40,9 @@ static void __init tango_clocksource_init(struct device_node *np) delay_timer.freq = xtal_freq; delay_timer.read_current_timer = read_xtal_counter; - ret = clocksource_register_hz(&tango_xtal, xtal_freq); - if (ret != 0) { + ret = clocksource_mmio_init(xtal_in_cnt, "tango-xtal", xtal_freq, 350, + 32, clocksource_mmio_readl_up); + if (!ret) { pr_err("%s: registration failed\n", np->full_name); return; }