microblaze: Decrease time shifting values

Lower shifting values ensure that shifted 32bit counter
value doesn't exceed 64bit cycle variable too fast.

Signed-off-by: Michal Simek <monstr@monstr.eu>
This commit is contained in:
Michal Simek
2010-06-10 16:04:05 +02:00
parent 615748aefa
commit c8f77436d1

View File

@@ -28,6 +28,7 @@
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/system.h> #include <asm/system.h>
#include <linux/cnt32_to_63.h>
#ifdef CONFIG_SELFMOD_TIMER #ifdef CONFIG_SELFMOD_TIMER
#include <asm/selfmod.h> #include <asm/selfmod.h>
@@ -135,7 +136,7 @@ static void microblaze_timer_set_mode(enum clock_event_mode mode,
static struct clock_event_device clockevent_microblaze_timer = { static struct clock_event_device clockevent_microblaze_timer = {
.name = "microblaze_clockevent", .name = "microblaze_clockevent",
.features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC, .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC,
.shift = 24, .shift = 8,
.rating = 300, .rating = 300,
.set_next_event = microblaze_timer_set_next_event, .set_next_event = microblaze_timer_set_next_event,
.set_mode = microblaze_timer_set_mode, .set_mode = microblaze_timer_set_mode,
@@ -195,7 +196,7 @@ static cycle_t microblaze_cc_read(const struct cyclecounter *cc)
static struct cyclecounter microblaze_cc = { static struct cyclecounter microblaze_cc = {
.read = microblaze_cc_read, .read = microblaze_cc_read,
.mask = CLOCKSOURCE_MASK(32), .mask = CLOCKSOURCE_MASK(32),
.shift = 24, .shift = 8,
}; };
int __init init_microblaze_timecounter(void) int __init init_microblaze_timecounter(void)
@@ -213,7 +214,7 @@ static struct clocksource clocksource_microblaze = {
.rating = 300, .rating = 300,
.read = microblaze_read, .read = microblaze_read,
.mask = CLOCKSOURCE_MASK(32), .mask = CLOCKSOURCE_MASK(32),
.shift = 24, /* I can shift it */ .shift = 8, /* I can shift it */
.flags = CLOCK_SOURCE_IS_CONTINUOUS, .flags = CLOCK_SOURCE_IS_CONTINUOUS,
}; };
@@ -302,7 +303,7 @@ unsigned long long notrace sched_clock(void)
{ {
if (timer_initialized) { if (timer_initialized) {
struct clocksource *cs = &clocksource_microblaze; struct clocksource *cs = &clocksource_microblaze;
cycle_t cyc = cs->read(NULL); cycle_t cyc = cnt32_to_63(cs->read(NULL));
return clocksource_cyc2ns(cyc, cs->mult, cs->shift); return clocksource_cyc2ns(cyc, cs->mult, cs->shift);
} }
return 0; return 0;