1 // SPDX-License-Identifier: GPL-2.0
3 * Precise Delay Loops for S390
5 * Copyright IBM Corp. 1999, 2008
6 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>,
9 #include <linux/processor.h>
10 #include <linux/delay.h>
11 #include <asm/div64.h>
12 #include <asm/timex.h>
14 void __delay(unsigned long loops)
17 * Loop 'loops' times. Callers must not assume a specific
18 * amount of time passes before this function returns.
20 asm volatile("0: brct %0,0b" : : "d" ((loops/2) + 1));
22 EXPORT_SYMBOL(__delay);
24 static void delay_loop(unsigned long delta)
28 end = get_tod_clock_monotonic() + delta;
29 while (!tod_after(get_tod_clock_monotonic(), end))
33 void __udelay(unsigned long usecs)
35 delay_loop(usecs << 12);
37 EXPORT_SYMBOL(__udelay);
39 void __ndelay(unsigned long nsecs)
45 EXPORT_SYMBOL(__ndelay);