Fix bug in udelay(): incorrect CPU_KHZ multiply factor.

This commit is contained in:
Serge Vakulenko
2015-10-08 12:30:34 -07:00
parent 793e6052bd
commit f7d93551cb

View File

@@ -671,13 +671,16 @@ boot(dev, howto)
/*
* Microsecond delay routine for MIPS processor.
*
* We rely on a hardware register Count, which is increased
* every next clock cycle, i.e. at rate CPU_KHZ/2 per millisecond.
*/
void
udelay(usec)
u_int usec;
{
unsigned now = mips_read_c0_register(C0_COUNT, 0);
unsigned final = now + usec * (CPU_KHZ / 1000);
unsigned final = now + usec * (CPU_KHZ / 1000) / 2;
for (;;) {
now = mips_read_c0_register(C0_COUNT, 0);