]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
MIPS: Fix mdelay(1) for 64bit kernel with HZ == 1000
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>
Wed, 30 Nov 2005 04:33:26 +0000 (13:33 +0900)
committer <ralf@denk.linux-mips.net> <>
Tue, 10 Jan 2006 13:39:04 +0000 (13:39 +0000)
mdelay(1) (i.e. udelay(1000)) does not work correctly due to overflow.

1000 * 0x004189374BC6A7f0 = 0x10000000000000180 (>= 2**64)

0x004189374BC6A7ef (0x004189374BC6A7f0 - 1) is OK and it is exactly
same as catchall case (0x8000000000000000UL / (500000 / HZ)).

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
include/asm-mips/delay.h

index 48d00cccdafa9a5f490b47c1407a7ce14fa0a1a0..64dd45150f64f69e38c7116a28a05a0c508015ae 100644 (file)
@@ -52,13 +52,11 @@ static inline void __udelay(unsigned long usecs, unsigned long lpj)
        unsigned long lo;
 
        /*
-        * The common rates of 1000 and 128 are rounded wrongly by the
-        * catchall case for 64-bit.  Excessive precission?  Probably ...
+        * The rates of 128 is rounded wrongly by the catchall case
+        * for 64-bit.  Excessive precission?  Probably ...
         */
 #if defined(CONFIG_64BIT) && (HZ == 128)
        usecs *= 0x0008637bd05af6c7UL;          /* 2**64 / (1000000 / HZ) */
-#elif defined(CONFIG_64BIT) && (HZ == 1000)
-       usecs *= 0x004189374BC6A7f0UL;          /* 2**64 / (1000000 / HZ) */
 #elif defined(CONFIG_64BIT)
        usecs *= (0x8000000000000000UL / (500000 / HZ));
 #else /* 32-bit junk follows here */