diff options
-rw-r--r-- | arch/s390/include/asm/delay.h | 1 | ||||
-rw-r--r-- | arch/s390/lib/delay.c | 13 | ||||
-rw-r--r-- | drivers/s390/cio/cio.c | 17 |
3 files changed, 16 insertions, 15 deletions
diff --git a/arch/s390/include/asm/delay.h b/arch/s390/include/asm/delay.h index 78357314c450..a356c958e260 100644 --- a/arch/s390/include/asm/delay.h +++ b/arch/s390/include/asm/delay.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #define _S390_DELAY_H | 15 | #define _S390_DELAY_H |
16 | 16 | ||
17 | extern void __udelay(unsigned long usecs); | 17 | extern void __udelay(unsigned long usecs); |
18 | extern void udelay_simple(unsigned long usecs); | ||
18 | extern void __delay(unsigned long loops); | 19 | extern void __delay(unsigned long loops); |
19 | 20 | ||
20 | #define udelay(n) __udelay(n) | 21 | #define udelay(n) __udelay(n) |
diff --git a/arch/s390/lib/delay.c b/arch/s390/lib/delay.c index 0953cee05efc..6ccb9fab055a 100644 --- a/arch/s390/lib/delay.c +++ b/arch/s390/lib/delay.c | |||
@@ -92,3 +92,16 @@ out: | |||
92 | local_irq_restore(flags); | 92 | local_irq_restore(flags); |
93 | preempt_enable(); | 93 | preempt_enable(); |
94 | } | 94 | } |
95 | |||
96 | /* | ||
97 | * Simple udelay variant. To be used on startup and reboot | ||
98 | * when the interrupt handler isn't working. | ||
99 | */ | ||
100 | void udelay_simple(unsigned long usecs) | ||
101 | { | ||
102 | u64 end; | ||
103 | |||
104 | end = get_clock() + ((u64) usecs << 12); | ||
105 | while (get_clock() < end) | ||
106 | cpu_relax(); | ||
107 | } | ||
diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c index c0cb72547256..3db2c386546f 100644 --- a/drivers/s390/cio/cio.c +++ b/drivers/s390/cio/cio.c | |||
@@ -859,19 +859,6 @@ __disable_subchannel_easy(struct subchannel_id schid, struct schib *schib) | |||
859 | return -EBUSY; /* uhm... */ | 859 | return -EBUSY; /* uhm... */ |
860 | } | 860 | } |
861 | 861 | ||
862 | /* we can't use the normal udelay here, since it enables external interrupts */ | ||
863 | |||
864 | static void udelay_reset(unsigned long usecs) | ||
865 | { | ||
866 | uint64_t start_cc, end_cc; | ||
867 | |||
868 | asm volatile ("STCK %0" : "=m" (start_cc)); | ||
869 | do { | ||
870 | cpu_relax(); | ||
871 | asm volatile ("STCK %0" : "=m" (end_cc)); | ||
872 | } while (((end_cc - start_cc)/4096) < usecs); | ||
873 | } | ||
874 | |||
875 | static int | 862 | static int |
876 | __clear_io_subchannel_easy(struct subchannel_id schid) | 863 | __clear_io_subchannel_easy(struct subchannel_id schid) |
877 | { | 864 | { |
@@ -887,7 +874,7 @@ __clear_io_subchannel_easy(struct subchannel_id schid) | |||
887 | if (schid_equal(&ti.schid, &schid)) | 874 | if (schid_equal(&ti.schid, &schid)) |
888 | return 0; | 875 | return 0; |
889 | } | 876 | } |
890 | udelay_reset(100); | 877 | udelay_simple(100); |
891 | } | 878 | } |
892 | return -EBUSY; | 879 | return -EBUSY; |
893 | } | 880 | } |
@@ -895,7 +882,7 @@ __clear_io_subchannel_easy(struct subchannel_id schid) | |||
895 | static void __clear_chsc_subchannel_easy(void) | 882 | static void __clear_chsc_subchannel_easy(void) |
896 | { | 883 | { |
897 | /* It seems we can only wait for a bit here :/ */ | 884 | /* It seems we can only wait for a bit here :/ */ |
898 | udelay_reset(100); | 885 | udelay_simple(100); |
899 | } | 886 | } |
900 | 887 | ||
901 | static int pgm_check_occured; | 888 | static int pgm_check_occured; |