From patchwork Tue May 10 07:34:21 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King - ARM Linux X-Patchwork-Id: 772802 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p4A7YeS4015556 for ; Tue, 10 May 2011 07:34:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754553Ab1EJHei (ORCPT ); Tue, 10 May 2011 03:34:38 -0400 Received: from caramon.arm.linux.org.uk ([78.32.30.218]:57679 "EHLO caramon.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752439Ab1EJHei (ORCPT ); Tue, 10 May 2011 03:34:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=caramon; h=Sender:Content-Type:MIME-Version:Subject:Cc:To:From:References:In-Reply-To:Message-Id:Date; bh=hf+QJyG0OfbJAZuxIwiOmcZPJW5a377R+P+SEO20mkc=; b=YR1/8NMRXJXoHwcvKOz5kOjaCnkHwpednimmAAkZF9IFczOE5PNy0vJONNvQ7LGy1CM3grDvgrJCYfHwVghuEO1bG0d9aURDbx8U/IAnwqPCpWiML9vND7cgMsfFq4ybB+7/KiMYl0QCHtPB/cbPFj34qdb/qqDE12gvMlEMkRI=; Received: from e0022681537dd.dyn.arm.linux.org.uk ([2002:4e20:1eda:1:222:68ff:fe15:37dd] helo=rmk-PC.arm.linux.org.uk) by caramon.arm.linux.org.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1QJhSY-0005ki-3U; Tue, 10 May 2011 08:34:22 +0100 Received: from rmk by rmk-PC.arm.linux.org.uk with local (Exim 4.72) (envelope-from ) id 1QJhSX-0000zA-0E; Tue, 10 May 2011 08:34:21 +0100 Date: Tue, 10 May 2011 08:34:21 +0100 Message-Id: In-Reply-To: <20110510072700.GA29869@n2100.arm.linux.org.uk> References: <20110510072700.GA29869@n2100.arm.linux.org.uk> From: Russell King - ARM Linux To: linux-arm-kernel@lists.infradead.org, John Stultz , Thomas Gleixner Cc: Tony Lindgren , linux-omap@vger.kernel.org Subject: [PATCH 13/13] clocksource: convert OMAP1 to 32-bit down counting clocksource MIME-Version: 1.0 Content-Disposition: inline Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 10 May 2011 07:34:40 +0000 (UTC) Convert the OMAP1 32-bit down counting clocksource to the generic clocksource infrastructure. Cc: Tony Lindgren Cc: linux-omap@vger.kernel.org Signed-off-by: Russell King Tested-by: Tony Lindgren --- arch/arm/mach-omap1/time.c | 23 ++++++----------------- arch/arm/plat-omap/Kconfig | 1 + 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c index e7ab616..03e1e10 100644 --- a/arch/arm/mach-omap1/time.c +++ b/arch/arm/mach-omap1/time.c @@ -190,24 +190,11 @@ static __init void omap_init_mpu_timer(unsigned long rate) * --------------------------------------------------------------------------- */ -static cycle_t mpu_read(struct clocksource *cs) -{ - return ~omap_mpu_timer_read(1); -} - -static struct clocksource clocksource_mpu = { - .name = "mpu_timer2", - .rating = 300, - .read = mpu_read, - .mask = CLOCKSOURCE_MASK(32), - .flags = CLOCK_SOURCE_IS_CONTINUOUS, -}; - static DEFINE_CLOCK_DATA(cd); static inline unsigned long long notrace _omap_mpu_sched_clock(void) { - u32 cyc = mpu_read(&clocksource_mpu); + u32 cyc = ~omap_mpu_timer_read(1); return cyc_to_sched_clock(&cd, cyc, (u32)~0); } @@ -225,20 +212,22 @@ static unsigned long long notrace omap_mpu_sched_clock(void) static void notrace mpu_update_sched_clock(void) { - u32 cyc = mpu_read(&clocksource_mpu); + u32 cyc = ~omap_mpu_timer_read(1); update_sched_clock(&cd, cyc, (u32)~0); } static void __init omap_init_clocksource(unsigned long rate) { + omap_mpu_timer_regs_t __iomem *timer = omap_mpu_timer_base(1); static char err[] __initdata = KERN_ERR "%s: can't register clocksource!\n"; omap_mpu_timer_start(1, ~0, 1); init_sched_clock(&cd, mpu_update_sched_clock, 32, rate); - if (clocksource_register_hz(&clocksource_mpu, rate)) - printk(err, clocksource_mpu.name); + if (clocksource_mmio_init(&timer->read_tim, "mpu_timer2", rate, + 300, 32, clocksource_mmio_readl_down)) + printk(err, "mpu_timer2"); } static void __init omap_mpu_timer_init(void) diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig index cd5f993..e9c0efc 100644 --- a/arch/arm/plat-omap/Kconfig +++ b/arch/arm/plat-omap/Kconfig @@ -12,6 +12,7 @@ choice config ARCH_OMAP1 bool "TI OMAP1" select CLKDEV_LOOKUP + select CLKSRC_MMIO help "Systems based on omap7xx, omap15xx or omap16xx"