aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/kernel/cevt-r4k.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/arch/mips/kernel/cevt-r4k.c b/arch/mips/kernel/cevt-r4k.c
index 7274fd2513f9..a59f67ff301e 100644
--- a/arch/mips/kernel/cevt-r4k.c
+++ b/arch/mips/kernel/cevt-r4k.c
@@ -179,7 +179,7 @@ static int c0_compare_int_pending(void)
179 179
180static int c0_compare_int_usable(void) 180static int c0_compare_int_usable(void)
181{ 181{
182 const unsigned int delta = 0x300000; 182 unsigned int delta;
183 unsigned int cnt; 183 unsigned int cnt;
184 184
185 /* 185 /*
@@ -192,9 +192,15 @@ static int c0_compare_int_usable(void)
192 return 0; 192 return 0;
193 } 193 }
194 194
195 cnt = read_c0_count(); 195 for (delta = 0x10; delta <= 0x400000; delta <<= 1) {
196 cnt += delta; 196 cnt = read_c0_count();
197 write_c0_compare(cnt); 197 cnt += delta;
198 write_c0_compare(cnt);
199 irq_disable_hazard();
200 if ((int)(read_c0_count() - cnt) < 0)
201 break;
202 /* increase delta if the timer was already expired */
203 }
198 204
199 while ((int)(read_c0_count() - cnt) <= 0) 205 while ((int)(read_c0_count() - cnt) <= 0)
200 ; /* Wait for expiry */ 206 ; /* Wait for expiry */