ppc: fix ciface_milliseconds using incorrect frequency for delay
Instead of using a constant frequency for all CPUs, use the processor timebase
frequency provided by QEMU. This fixes issues where delays from
ciface_milliseconds were not corresponding to elapsed time as given by the real
time clock on certain platforms, eg. QEMU's mac99 machine.
Signed-off-by: Glenn Washburn <development@efficientek.com>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
diff --git a/arch/ppc/qemu/methods.c b/arch/ppc/qemu/methods.c
index 930b47c..a423b9f 100644
--- a/arch/ppc/qemu/methods.c
+++ b/arch/ppc/qemu/methods.c
@@ -126,7 +126,8 @@
}
/* ( -- ms ) */
-#define TIMER_FREQUENCY 16600000ULL
+/* From drivers/timer.c */
+extern unsigned long timer_freq;
static void
ciface_milliseconds( unsigned long args[], unsigned long ret[] )
@@ -146,7 +147,7 @@
: "cc");
ticks = (((unsigned long long)tbu) << 32) | (unsigned long long)tbl;
- msecs = (1000 * ticks) / TIMER_FREQUENCY;
+ msecs = (1000 * ticks) / timer_freq;
PUSH( msecs );
}