[S390] delay: implement ndelay
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Thu, 26 May 2011 07:48:28 +0000 (09:48 +0200)
committerHeiko Carstens <heiko.carstens@de.ibm.com>
Thu, 26 May 2011 07:48:25 +0000 (09:48 +0200)
Implement ndelay() on s390 as well.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/include/asm/delay.h
arch/s390/lib/delay.c

index 8a096b83f51f634623217fc3b5da8f61520a81e7..0e3b35f96be174c12df5d93e33acee36532bcb61 100644 (file)
 #ifndef _S390_DELAY_H
 #define _S390_DELAY_H
 
-extern void __udelay(unsigned long long usecs);
-extern void udelay_simple(unsigned long long usecs);
-extern void __delay(unsigned long loops);
+void __ndelay(unsigned long long nsecs);
+void __udelay(unsigned long long usecs);
+void udelay_simple(unsigned long long usecs);
+void __delay(unsigned long loops);
 
+#define ndelay(n) __ndelay((unsigned long long) (n))
 #define udelay(n) __udelay((unsigned long long) (n))
 #define mdelay(n) __udelay((unsigned long long) (n) * 1000)
 
index 0f53110e1d09a36eb5ab794285d30854abe82a27..a65229d91c92be055931de197528c67d3403837c 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/module.h>
 #include <linux/irqflags.h>
 #include <linux/interrupt.h>
+#include <asm/div64.h>
 
 void __delay(unsigned long loops)
 {
@@ -116,3 +117,17 @@ void udelay_simple(unsigned long long usecs)
        while (get_clock() < end)
                cpu_relax();
 }
+
+void __ndelay(unsigned long long nsecs)
+{
+       u64 end;
+
+       nsecs <<= 9;
+       do_div(nsecs, 125);
+       end = get_clock() + nsecs;
+       if (nsecs & ~0xfffUL)
+               __udelay(nsecs >> 12);
+       while (get_clock() < end)
+               barrier();
+}
+EXPORT_SYMBOL(__ndelay);