Commit 30c9c5b1 authored by Marc Zyngier's avatar Marc Zyngier

ARM: davinci: convert to common sched_clock() implementation

Davinci has its own sched_clock() implementation, which gets in the
way of a single zImage. Moving to the common sched_clock framework
makes the code slightly cleaner.
Acked-by: default avatarSekhar Nori <nsekhar@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
parent 5d0ef6ae
...@@ -932,6 +932,7 @@ config ARCH_DAVINCI ...@@ -932,6 +932,7 @@ config ARCH_DAVINCI
select ARCH_REQUIRE_GPIOLIB select ARCH_REQUIRE_GPIOLIB
select ZONE_DMA select ZONE_DMA
select HAVE_IDE select HAVE_IDE
select HAVE_SCHED_CLOCK
select CLKDEV_LOOKUP select CLKDEV_LOOKUP
select GENERIC_ALLOCATOR select GENERIC_ALLOCATOR
select GENERIC_IRQ_CHIP select GENERIC_IRQ_CHIP
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <asm/sched_clock.h>
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <asm/mach/time.h> #include <asm/mach/time.h>
...@@ -274,19 +275,9 @@ static cycle_t read_cycles(struct clocksource *cs) ...@@ -274,19 +275,9 @@ static cycle_t read_cycles(struct clocksource *cs)
return (cycles_t)timer32_read(t); return (cycles_t)timer32_read(t);
} }
/*
* Kernel assumes that sched_clock can be called early but may not have
* things ready yet.
*/
static cycle_t read_dummy(struct clocksource *cs)
{
return 0;
}
static struct clocksource clocksource_davinci = { static struct clocksource clocksource_davinci = {
.rating = 300, .rating = 300,
.read = read_dummy, .read = read_cycles,
.mask = CLOCKSOURCE_MASK(32), .mask = CLOCKSOURCE_MASK(32),
.flags = CLOCK_SOURCE_IS_CONTINUOUS, .flags = CLOCK_SOURCE_IS_CONTINUOUS,
}; };
...@@ -294,12 +285,9 @@ static struct clocksource clocksource_davinci = { ...@@ -294,12 +285,9 @@ static struct clocksource clocksource_davinci = {
/* /*
* Overwrite weak default sched_clock with something more precise * Overwrite weak default sched_clock with something more precise
*/ */
unsigned long long notrace sched_clock(void) static u32 notrace davinci_read_sched_clock(void)
{ {
const cycle_t cyc = clocksource_davinci.read(&clocksource_davinci); return timer32_read(&timers[TID_CLOCKSOURCE]);
return clocksource_cyc2ns(cyc, clocksource_davinci.mult,
clocksource_davinci.shift);
} }
/* /*
...@@ -399,12 +387,14 @@ static void __init davinci_timer_init(void) ...@@ -399,12 +387,14 @@ static void __init davinci_timer_init(void)
davinci_clock_tick_rate = clk_get_rate(timer_clk); davinci_clock_tick_rate = clk_get_rate(timer_clk);
/* setup clocksource */ /* setup clocksource */
clocksource_davinci.read = read_cycles;
clocksource_davinci.name = id_to_name[clocksource_id]; clocksource_davinci.name = id_to_name[clocksource_id];
if (clocksource_register_hz(&clocksource_davinci, if (clocksource_register_hz(&clocksource_davinci,
davinci_clock_tick_rate)) davinci_clock_tick_rate))
printk(err, clocksource_davinci.name); printk(err, clocksource_davinci.name);
setup_sched_clock(davinci_read_sched_clock, 32,
davinci_clock_tick_rate);
/* setup clockevent */ /* setup clockevent */
clockevent_davinci.name = id_to_name[timers[TID_CLOCKEVENT].id]; clockevent_davinci.name = id_to_name[timers[TID_CLOCKEVENT].id];
clockevent_davinci.mult = div_sc(davinci_clock_tick_rate, NSEC_PER_SEC, clockevent_davinci.mult = div_sc(davinci_clock_tick_rate, NSEC_PER_SEC,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment