aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2009-10-06 04:34:05 -0400
committerMartin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com>2009-10-06 04:35:08 -0400
commit0cd6a403e8f86bb24975e4c16ce640a063475515 (patch)
treec1231230d8407da6149502fbfc9f5152049ef0e1 /arch/s390
parent78d81f2f844b739b377817cfd279fb6067e191a7 (diff)
[S390] Provide arch specific mdelay implementation.
Use an own implementation instead of the common code udelay loop. 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.h7
-rw-r--r--arch/s390/lib/delay.c14
2 files changed, 11 insertions, 10 deletions
diff --git a/arch/s390/include/asm/delay.h b/arch/s390/include/asm/delay.h
index a356c958e260..8a096b83f51f 100644
--- a/arch/s390/include/asm/delay.h
+++ b/arch/s390/include/asm/delay.h
@@ -14,10 +14,11 @@
14#ifndef _S390_DELAY_H 14#ifndef _S390_DELAY_H
15#define _S390_DELAY_H 15#define _S390_DELAY_H
16 16
17extern void __udelay(unsigned long usecs); 17extern void __udelay(unsigned long long usecs);
18extern void udelay_simple(unsigned long usecs); 18extern void udelay_simple(unsigned long long usecs);
19extern void __delay(unsigned long loops); 19extern void __delay(unsigned long loops);
20 20
21#define udelay(n) __udelay(n) 21#define udelay(n) __udelay((unsigned long long) (n))
22#define mdelay(n) __udelay((unsigned long long) (n) * 1000)
22 23
23#endif /* defined(_S390_DELAY_H) */ 24#endif /* defined(_S390_DELAY_H) */
diff --git a/arch/s390/lib/delay.c b/arch/s390/lib/delay.c
index 2c3094342789..752b362bf651 100644
--- a/arch/s390/lib/delay.c
+++ b/arch/s390/lib/delay.c
@@ -25,13 +25,13 @@ void __delay(unsigned long loops)
25 asm volatile("0: brct %0,0b" : : "d" ((loops/2) + 1)); 25 asm volatile("0: brct %0,0b" : : "d" ((loops/2) + 1));
26} 26}
27 27
28static void __udelay_disabled(unsigned long usecs) 28static void __udelay_disabled(unsigned long long usecs)
29{ 29{
30 unsigned long mask, cr0, cr0_saved; 30 unsigned long mask, cr0, cr0_saved;
31 u64 clock_saved; 31 u64 clock_saved;
32 32
33 clock_saved = local_tick_disable(); 33 clock_saved = local_tick_disable();
34 set_clock_comparator(get_clock() + ((u64) usecs << 12)); 34 set_clock_comparator(get_clock() + (usecs << 12));
35 __ctl_store(cr0_saved, 0, 0); 35 __ctl_store(cr0_saved, 0, 0);
36 cr0 = (cr0_saved & 0xffff00e0) | 0x00000800; 36 cr0 = (cr0_saved & 0xffff00e0) | 0x00000800;
37 __ctl_load(cr0 , 0, 0); 37 __ctl_load(cr0 , 0, 0);
@@ -46,14 +46,14 @@ static void __udelay_disabled(unsigned long usecs)
46 set_clock_comparator(S390_lowcore.clock_comparator); 46 set_clock_comparator(S390_lowcore.clock_comparator);
47} 47}
48 48
49static void __udelay_enabled(unsigned long usecs) 49static void __udelay_enabled(unsigned long long usecs)
50{ 50{
51 unsigned long mask; 51 unsigned long mask;
52 u64 clock_saved; 52 u64 clock_saved;
53 u64 end; 53 u64 end;
54 54
55 mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT | PSW_MASK_IO; 55 mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT | PSW_MASK_IO;
56 end = get_clock() + ((u64) usecs << 12); 56 end = get_clock() + (usecs << 12);
57 do { 57 do {
58 clock_saved = 0; 58 clock_saved = 0;
59 if (end < S390_lowcore.clock_comparator) { 59 if (end < S390_lowcore.clock_comparator) {
@@ -72,7 +72,7 @@ static void __udelay_enabled(unsigned long usecs)
72/* 72/*
73 * Waits for 'usecs' microseconds using the TOD clock comparator. 73 * Waits for 'usecs' microseconds using the TOD clock comparator.
74 */ 74 */
75void __udelay(unsigned long usecs) 75void __udelay(unsigned long long usecs)
76{ 76{
77 unsigned long flags; 77 unsigned long flags;
78 78
@@ -106,11 +106,11 @@ EXPORT_SYMBOL(__udelay);
106 * Simple udelay variant. To be used on startup and reboot 106 * Simple udelay variant. To be used on startup and reboot
107 * when the interrupt handler isn't working. 107 * when the interrupt handler isn't working.
108 */ 108 */
109void udelay_simple(unsigned long usecs) 109void udelay_simple(unsigned long long usecs)
110{ 110{
111 u64 end; 111 u64 end;
112 112
113 end = get_clock() + ((u64) usecs << 12); 113 end = get_clock() + (usecs << 12);
114 while (get_clock() < end) 114 while (get_clock() < end)
115 cpu_relax(); 115 cpu_relax();
116} 116}