diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2011-05-26 03:48:28 -0400 |
---|---|---|
committer | Heiko Carstens <heiko.carstens@de.ibm.com> | 2011-05-26 03:48:25 -0400 |
commit | b396637841fff79e9520514e8dcbe769c20a2ea0 (patch) | |
tree | b268ca9d099e8e7514ed72e6035c08df0fd9f8e4 /arch/s390 | |
parent | ac5fa22fd4f27376e4ec41b44279c9992322d7ce (diff) |
[S390] delay: implement ndelay
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>
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/include/asm/delay.h | 8 | ||||
-rw-r--r-- | arch/s390/lib/delay.c | 15 |
2 files changed, 20 insertions, 3 deletions
diff --git a/arch/s390/include/asm/delay.h b/arch/s390/include/asm/delay.h index 8a096b83f51f..0e3b35f96be1 100644 --- a/arch/s390/include/asm/delay.h +++ b/arch/s390/include/asm/delay.h | |||
@@ -14,10 +14,12 @@ | |||
14 | #ifndef _S390_DELAY_H | 14 | #ifndef _S390_DELAY_H |
15 | #define _S390_DELAY_H | 15 | #define _S390_DELAY_H |
16 | 16 | ||
17 | extern void __udelay(unsigned long long usecs); | 17 | void __ndelay(unsigned long long nsecs); |
18 | extern void udelay_simple(unsigned long long usecs); | 18 | void __udelay(unsigned long long usecs); |
19 | extern void __delay(unsigned long loops); | 19 | void udelay_simple(unsigned long long usecs); |
20 | void __delay(unsigned long loops); | ||
20 | 21 | ||
22 | #define ndelay(n) __ndelay((unsigned long long) (n)) | ||
21 | #define udelay(n) __udelay((unsigned long long) (n)) | 23 | #define udelay(n) __udelay((unsigned long long) (n)) |
22 | #define mdelay(n) __udelay((unsigned long long) (n) * 1000) | 24 | #define mdelay(n) __udelay((unsigned long long) (n) * 1000) |
23 | 25 | ||
diff --git a/arch/s390/lib/delay.c b/arch/s390/lib/delay.c index 0f53110e1d09..a65229d91c92 100644 --- a/arch/s390/lib/delay.c +++ b/arch/s390/lib/delay.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/irqflags.h> | 13 | #include <linux/irqflags.h> |
14 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
15 | #include <asm/div64.h> | ||
15 | 16 | ||
16 | void __delay(unsigned long loops) | 17 | void __delay(unsigned long loops) |
17 | { | 18 | { |
@@ -116,3 +117,17 @@ void udelay_simple(unsigned long long usecs) | |||
116 | while (get_clock() < end) | 117 | while (get_clock() < end) |
117 | cpu_relax(); | 118 | cpu_relax(); |
118 | } | 119 | } |
120 | |||
121 | void __ndelay(unsigned long long nsecs) | ||
122 | { | ||
123 | u64 end; | ||
124 | |||
125 | nsecs <<= 9; | ||
126 | do_div(nsecs, 125); | ||
127 | end = get_clock() + nsecs; | ||
128 | if (nsecs & ~0xfffUL) | ||
129 | __udelay(nsecs >> 12); | ||
130 | while (get_clock() < end) | ||
131 | barrier(); | ||
132 | } | ||
133 | EXPORT_SYMBOL(__ndelay); | ||