clocksource: convert OMAP1 to 32-bit down counting clocksource
authorRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 9 May 2011 08:51:03 +0000 (09:51 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 23 May 2011 17:04:52 +0000 (18:04 +0100)
Convert the OMAP1 32-bit down counting clocksource to the generic
clocksource infrastructure.

Tested-by: Tony Lindgren <tony@atomide.com>
Cc: linux-omap@vger.kernel.org
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-omap1/time.c
arch/arm/plat-omap/Kconfig

index e7ab61625b443697ac48ddc7fc064e9a63e52de2..03e1e1062ad4d782419ce3dd3d3489fad9eb55cd 100644 (file)
@@ -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)
index cd5f993612fdd0a5dd0a0e8744118c7578a214c4..e9c0efc5d4af965a6d80a516d675854ceacbbb72 100644 (file)
@@ -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"