[PATCH 2.5] udelay

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

	The HZ constant has changed in 2.5 and udelay doesn't work
properly anymore. Here's a patch to fix it. I checked the first multiply
is still optimized out during compilation if the delay is constant. It's
for mips64, but mips32 needs it as well.

Vivien.

--- include/asm-mips64/delay.h	2002-12-11 20:44:20.000000000 +0100
+++ include/asm-mips64/delay.h	2002-12-21 18:48:12.000000000 +0100
@@ -41,11 +41,10 @@
 {
 	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));



[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux