From patchwork Mon Jun 3 09:30:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 2651531 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id D79EB3FC23 for ; Mon, 3 Jun 2013 09:40:39 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UjRBL-0007Ej-Uy; Mon, 03 Jun 2013 09:36:15 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UjR8q-0001yP-Rh; Mon, 03 Jun 2013 09:33:28 +0000 Received: from mail-pd0-f178.google.com ([209.85.192.178]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UjR8U-0001tu-Qw for linux-arm-kernel@lists.infradead.org; Mon, 03 Jun 2013 09:33:08 +0000 Received: by mail-pd0-f178.google.com with SMTP id w16so610045pde.23 for ; Mon, 03 Jun 2013 02:32:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=64y24uytHja3pX8MCWqeL6dk7D2AltHFO93TNwzIvK8=; b=LXu+yawvu/cX8K1pGKX0wxwrwM3s08cNtmqgU/QQevc00mYw6S9B7Oc96TdEHThK8X P+nemfG7Kvc0VzhSc+hmpFdBRzWhz4VVk5OnZ2EfSN+oeSFC1lp3JDpgTdjjXYjFIGmf 0t2MkEbxOj/LqK+N+oWzdIAlt7eZI4Mk6b7pkNhy+I8j+Q0v+F2uxyXG5HPiqlIgODs+ sXi0zEAH18QbZ5pe0WlqPGJkMoqLR6MOpMdjoTCqXeOs0kQbRyeGvdPq5djsYDDhDopD 09Uew1I1YIWiunksvQ6HKep7DlnRzsYrnoPzlwQhvyGHC5sG2W1adh43Nk5sSHQrJ2L7 8mJQ== X-Received: by 10.68.228.161 with SMTP id sj1mr23581578pbc.151.1370251965379; Mon, 03 Jun 2013 02:32:45 -0700 (PDT) Received: from localhost.localdomain ([27.115.121.40]) by mx.google.com with ESMTPSA id wi6sm58333510pbc.22.2013.06.03.02.32.40 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Jun 2013 02:32:44 -0700 (PDT) From: Haojian Zhuang To: tglx@linutronix.de, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, chao.xie@marvell.com, john.stultz@linaro.org, mturquette@linaro.org, eric.y.miao@gmail.com Subject: [PATCH v3 11/11] ARCH: mmp: support clocksource in timer Date: Mon, 3 Jun 2013 17:30:45 +0800 Message-Id: <1370251845-31373-12-git-send-email-haojian.zhuang@gmail.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1370251845-31373-1-git-send-email-haojian.zhuang@gmail.com> References: <1370251845-31373-1-git-send-email-haojian.zhuang@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130603_053307_032972_DD30F0BD X-CRM114-Status: GOOD ( 15.97 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (haojian.zhuang[at]gmail.com) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [209.85.192.178 listed in list.dnswl.org] -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_VALID_AU Message has a valid DKIM or DK signature from author's domain 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 Cc: Haojian Zhuang , patches@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Support clocksource in timer-mmp driver. Signed-off-by: Haojian Zhuang --- arch/arm/mach-mmp/mmp-dt.c | 4 +--- arch/arm/mach-mmp/mmp2-dt.c | 2 +- drivers/clocksource/Kconfig | 6 ++++++ drivers/clocksource/Makefile | 2 +- drivers/clocksource/timer-mmp.c | 16 +++------------- 5 files changed, 12 insertions(+), 18 deletions(-) diff --git a/arch/arm/mach-mmp/mmp-dt.c b/arch/arm/mach-mmp/mmp-dt.c index 2b8f1f6..ff4a70b 100644 --- a/arch/arm/mach-mmp/mmp-dt.c +++ b/arch/arm/mach-mmp/mmp-dt.c @@ -18,8 +18,6 @@ #include "common.h" -extern void __init mmp_dt_init_timer(void); - static const struct of_dev_auxdata pxa168_auxdata_lookup[] __initconst = { OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4017000, "pxa2xx-uart.0", NULL), OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4018000, "pxa2xx-uart.1", NULL), @@ -63,7 +61,7 @@ static const char *mmp_dt_board_compat[] __initdata = { static void __init mmp_init_timer(void) { of_clk_init(NULL); - mmp_dt_init_timer(); + clocksource_of_init(); } DT_MACHINE_START(PXA168_DT, "Marvell PXA168 (Device Tree Support)") diff --git a/arch/arm/mach-mmp/mmp2-dt.c b/arch/arm/mach-mmp/mmp2-dt.c index 68a7642..9495105 100644 --- a/arch/arm/mach-mmp/mmp2-dt.c +++ b/arch/arm/mach-mmp/mmp2-dt.c @@ -40,7 +40,7 @@ static void __init mmp2_dt_init(void) static void __init mmp2_init_timer(void) { of_clk_init(NULL); - mmp_dt_init_timer(); + clocksource_of_init(); } static const char *mmp2_dt_board_compat[] __initdata = { diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index f151c6c..f429f68 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -72,6 +72,12 @@ config CLKSRC_METAG_GENERIC help This option enables support for the Meta per-thread timers. +config CLKSRC_MMP + def_bool y if ARCH_MMP + select CLKSRC_OF if OF + help + This option enables support for the MMP timer. + config CLKSRC_EXYNOS_MCT def_bool y if ARCH_EXYNOS help diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile index f6aa3b6..d154705 100644 --- a/drivers/clocksource/Makefile +++ b/drivers/clocksource/Makefile @@ -10,6 +10,7 @@ obj-$(CONFIG_SH_TIMER_TMU) += sh_tmu.o obj-$(CONFIG_EM_TIMER_STI) += em_sti.o obj-$(CONFIG_CLKBLD_I8253) += i8253.o obj-$(CONFIG_CLKSRC_MMIO) += mmio.o +obj-$(CONFIG_CLKSRC_MMP) += timer-mmp.o obj-$(CONFIG_DW_APB_TIMER) += dw_apb_timer.o obj-$(CONFIG_DW_APB_TIMER_OF) += dw_apb_timer_of.o obj-$(CONFIG_CLKSRC_NOMADIK_MTU) += nomadik-mtu.o @@ -17,7 +18,6 @@ obj-$(CONFIG_CLKSRC_DBX500_PRCMU) += clksrc-dbx500-prcmu.o obj-$(CONFIG_ARMADA_370_XP_TIMER) += time-armada-370-xp.o obj-$(CONFIG_ARCH_BCM2835) += bcm2835_timer.o obj-$(CONFIG_ARCH_MARCO) += timer-marco.o -obj-$(CONFIG_ARCH_MMP) += timer-mmp.o obj-$(CONFIG_ARCH_MXS) += mxs_timer.o obj-$(CONFIG_ARCH_PRIMA2) += timer-prima2.o obj-$(CONFIG_SUN4I_TIMER) += sun4i_timer.o diff --git a/drivers/clocksource/timer-mmp.c b/drivers/clocksource/timer-mmp.c index 39b8968..7ae4f95 100644 --- a/drivers/clocksource/timer-mmp.c +++ b/drivers/clocksource/timer-mmp.c @@ -235,22 +235,12 @@ void __init timer_init(int irq, int mmp2_mode) MIN_DELTA, MAX_DELTA); } -#ifdef CONFIG_OF -static struct of_device_id mmp_timer_dt_ids[] = { - { .compatible = "mrvl,mmp-timer", }, - {} -}; - -void __init mmp_dt_init_timer(void) +static void __init mmp_dt_init_timer(struct device_node *np) { - struct device_node *np; struct clk *clk; - int irq, ret; + int irq; u32 rate = 0; - np = of_find_matching_node(NULL, mmp_timer_dt_ids); - if (!np) - return; if (!of_device_is_available(np)) return; if (of_property_read_u32(np, "clock-frequency", &rate)) { @@ -288,4 +278,4 @@ void __init mmp_dt_init_timer(void) out: clk_put(clk); } -#endif +CLOCKSOURCE_OF_DECLARE(mmp_timer, "mrvl,mmp-timer", mmp_dt_init_timer);