Commit 3a6c43a7 authored by Atsushi Nemoto's avatar Atsushi Nemoto Committed by Ralf Baechle

[MIPS] time: Make c0_compare_int_usable faster

Try increasingly longer time periods starting of at 0x10 cycles.  This
should be fast on hardware and work nicely with emulators.
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent c637fecb
...@@ -179,7 +179,7 @@ static int c0_compare_int_pending(void) ...@@ -179,7 +179,7 @@ static int c0_compare_int_pending(void)
static int c0_compare_int_usable(void) static int c0_compare_int_usable(void)
{ {
const unsigned int delta = 0x300000; unsigned int delta;
unsigned int cnt; unsigned int cnt;
/* /*
...@@ -192,9 +192,15 @@ static int c0_compare_int_usable(void) ...@@ -192,9 +192,15 @@ static int c0_compare_int_usable(void)
return 0; return 0;
} }
for (delta = 0x10; delta <= 0x400000; delta <<= 1) {
cnt = read_c0_count(); cnt = read_c0_count();
cnt += delta; cnt += delta;
write_c0_compare(cnt); write_c0_compare(cnt);
irq_disable_hazard();
if ((int)(read_c0_count() - cnt) < 0)
break;
/* increase delta if the timer was already expired */
}
while ((int)(read_c0_count() - cnt) <= 0) while ((int)(read_c0_count() - cnt) <= 0)
; /* Wait for expiry */ ; /* Wait for expiry */
......
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