1 // SPDX-License-Identifier: GPL-2.0
3 * Precise Delay Loops for S390
5 * Copyright IBM Corp. 1999, 2008
10 #include <linux/processor.h>
11 #include <linux/delay.h>
12 #include <asm/div64.h>
13 #include <asm/timex.h>
15 void __delay(unsigned long loops)
18 * To end the bloody studid and useless discussion about the
19 * BogoMips number I took the liberty to define the __delay
20 * function in a way that that resulting BogoMips number will
21 * yield the megahertz number of the cpu. The important function
22 * is udelay and that is done using the tod clock. -- martin.
24 asm volatile("0: brct %0,0b" : : "d" ((loops/2) + 1));
26 EXPORT_SYMBOL(__delay);
28 static void delay_loop(unsigned long delta)
32 end = get_tod_clock_monotonic() + delta;
33 while (!tod_after(get_tod_clock_monotonic(), end))
37 void __udelay(unsigned long usecs)
39 delay_loop(usecs << 12);
41 EXPORT_SYMBOL(__udelay);
43 void __ndelay(unsigned long nsecs)
49 EXPORT_SYMBOL(__ndelay);