Hi,
The HZ constant has been changed in 2.5 and this breaks
udelay(). Here is a patch to fix this. Note that the first multiply in
udelay is still optimized out by the compiler if the delay is constant, as
in current implementation.
Vivien.
--- include/asm-mips64/delay.h 2002-12-11 20:44:20.000000000 +0100
+++ include/asm-mips64/delay.h 2003-01-07 20:36:37.000000000 +0100
@@ -41,11 +41,11 @@
{
unsigned long lo;
-#if (HZ == 100)
- usecs *= 0x00068db8bac710cbUL; /* 2**64 / (1000000 / HZ) */
-#elif (HZ == 128)
- usecs *= 0x0008637bd05af6c6UL; /* 2**64 / (1000000 / HZ) */
-#endif
+/* HZ * 2**64 / 1000000 */
+#define __UDELAY_FIXED64_HZ_1000000 (0x8000000000000000UL / (500000 / HZ))
+
+ usecs *= __UDELAY_FIXED64_HZ_1000000;
+
__asm__("dmultu\t%2,%3"
:"=h" (usecs), "=l" (lo)
:"r" (usecs),"r" (lpj));
--- include/asm-mips/delay.h 2002-12-11 20:44:18.000000000 +0100
+++ include/asm-mips/delay.h 2003-01-08 19:25:17.000000000 +0100
@@ -40,11 +40,10 @@
{
unsigned long lo;
-#if (HZ == 100)
- usecs *= 0x00068db8; /* 2**32 / (1000000 / HZ) */
-#elif (HZ == 128)
- usecs *= 0x0008637b; /* 2**32 / (1000000 / HZ) */
-#endif
+/* HZ * 2**32 / 1000000 */
+#define __UDELAY_FIXED32_HZ_1000000 (0x80000000UL / (500000 / HZ))
+
+ usecs *= __UDELAY_FIXED32_HZ_1000000;
__asm__("multu\t%2,%3"
:"=h" (usecs), "=l" (lo)
:"r" (usecs),"r" (lpj));
|