Blackfin: implement ndelay()
authorBarry Song <barry.song@analog.com>
Thu, 21 Jan 2010 07:20:44 +0000 (07:20 +0000)
committerMike Frysinger <vapier@gentoo.org>
Tue, 9 Mar 2010 05:30:50 +0000 (00:30 -0500)
Signed-off-by: Barry Song <barry.song@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
arch/blackfin/include/asm/delay.h

index c31f91cc1d5dbd5cd0677ed007c002313a784109..171d8deb04a5e0f431531e9ecaf7f57dbb2a58c5 100644 (file)
@@ -30,10 +30,22 @@ __asm__ __volatile__ (
 
 #define        HZSCALE         (268435456 / (1000000/HZ))
 
-static inline void udelay(unsigned long usecs)
+static inline unsigned long __to_delay(unsigned long scale)
 {
        extern unsigned long loops_per_jiffy;
-       __delay((((usecs * HZSCALE) >> 11) * (loops_per_jiffy >> 11)) >> 6);
+       return (((scale * HZSCALE) >> 11) * (loops_per_jiffy >> 11)) >> 6;
+}
+
+static inline void udelay(unsigned long usecs)
+{
+       __delay(__to_delay(usecs));
 }
 
+static inline void ndelay(unsigned long nsecs)
+{
+       __delay(__to_delay(1) * nsecs / 1000);
+}
+
+#define ndelay ndelay
+
 #endif