diff options
author | Keith M Wesolowski <wesolows@foobazco.org> | 2000-07-24 01:13:39 +0000 |
---|---|---|
committer | Keith M Wesolowski <wesolows@foobazco.org> | 2000-07-24 01:13:39 +0000 |
commit | 3b8d66c1df6a809505e9958a5138ab45bbf183d2 (patch) | |
tree | 42da1d0a6dccbaede0b332246fd7ca8013049672 /arch/mips/sgi | |
parent | f3627cbe9236a062012c836f3b6ee311b43f63f2 (diff) |
Fix a timer calibration bug. This should get rid of the delay loop hang.
Diffstat (limited to 'arch/mips/sgi')
-rw-r--r-- | arch/mips/sgi/kernel/setup.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/arch/mips/sgi/kernel/setup.c b/arch/mips/sgi/kernel/setup.c index afd52c343..f511e98de 100644 --- a/arch/mips/sgi/kernel/setup.c +++ b/arch/mips/sgi/kernel/setup.c @@ -180,7 +180,7 @@ void sgi_time_init (struct irqaction *irq) { */ struct sgi_ioc_timers *p; volatile unsigned char *tcwp, *tc2p; - unsigned long r4k_ticks[3]; + unsigned long r4k_ticks[3] = { 0, 0, 0 }; unsigned long r4k_next; /* Figure out the r4k offset, the algorithm is very simple @@ -198,15 +198,16 @@ void sgi_time_init (struct irqaction *irq) { tc2p = &p->tcnt2; printk("Calibrating system timer... "); - dosample(tcwp, tc2p); /* First sample. */ - dosample(tcwp, tc2p); /* Eat one. */ - r4k_ticks[0] = dosample(tcwp, tc2p); /* Second sample. */ - dosample(tcwp, tc2p); /* Eat another. */ - r4k_ticks[1] += dosample (tcwp, tc2p); /* Third sample. */ + dosample(tcwp, tc2p); /* Prime cache. */ + dosample(tcwp, tc2p); /* Prime cache. */ + /* Zero is NOT an option. */ + while (!r4k_ticks[0]) + r4k_ticks[0] = dosample (tcwp, tc2p); + while (!r4k_ticks[1]) + r4k_ticks[1] = dosample (tcwp, tc2p); if (r4k_ticks[0] != r4k_ticks[1]) { printk ("warning: timer counts differ, retrying..."); - dosample (tcwp, tc2p); r4k_ticks[2] = dosample (tcwp, tc2p); if (r4k_ticks[2] == r4k_ticks[0] || r4k_ticks[2] == r4k_ticks[1]) |