Skip to content

Commit

Permalink
[POWERPC] Make clockevents work on PPC601 processors
Browse files Browse the repository at this point in the history
In testing the new clocksource and clockevent code on a PPC601
processor, I discovered that the clockevent multiplier value for the
decrementer clockevent was overflowing.  Because the RTCL register in
the 601 effectively counts at 1GHz (it doesn't actually, but it
increases by 128 every 128ns), and the shift value was 32, that meant
the multiplier value had to be 2^32, which won't fit in an unsigned
long on 32-bit.  The same problem would arise on any platform where
the timebase frequency was 1GHz or more (not that we actually have any
such machines today).

This fixes it by reducing the shift value to 16.  Doing the
calculations with a resolution of 2^-16 nanoseconds (15 femtoseconds)
should be quite adequate.  :)

Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Paul Mackerras committed Oct 11, 2007
1 parent d968014 commit cdec12a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ static void decrementer_set_mode(enum clock_event_mode mode,
static struct clock_event_device decrementer_clockevent = {
.name = "decrementer",
.rating = 200,
.shift = 32,
.shift = 16,
.mult = 0, /* To be filled in */
.irq = 0,
.set_next_event = decrementer_set_next_event,
Expand Down

0 comments on commit cdec12a

Please sign in to comment.