aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/s390/include/asm/delay.h1
-rw-r--r--arch/s390/lib/delay.c13
-rw-r--r--drivers/s390/cio/cio.c17
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
17extern void __udelay(unsigned long usecs); 17extern void __udelay(unsigned long usecs);
18extern void udelay_simple(unsigned long usecs);
18extern void __delay(unsigned long loops); 19extern 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 */
100void 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
864static 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
875static int 862static 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)
895static void __clear_chsc_subchannel_easy(void) 882static 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
901static int pgm_check_occured; 888static int pgm_check_occured;