xref: /openbmc/linux/arch/um/include/asm/delay.h (revision 7559e757)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __UM_DELAY_H
3 #define __UM_DELAY_H
4 #include <asm-generic/delay.h>
5 #include <linux/time-internal.h>
6 
7 static inline void um_ndelay(unsigned long nsecs)
8 {
9 	if (time_travel_mode == TT_MODE_INFCPU ||
10 	    time_travel_mode == TT_MODE_EXTERNAL) {
11 		time_travel_ndelay(nsecs);
12 		return;
13 	}
14 	ndelay(nsecs);
15 }
16 #undef ndelay
17 #define ndelay(n) um_ndelay(n)
18 
19 static inline void um_udelay(unsigned long usecs)
20 {
21 	if (time_travel_mode == TT_MODE_INFCPU ||
22 	    time_travel_mode == TT_MODE_EXTERNAL) {
23 		time_travel_ndelay(1000 * usecs);
24 		return;
25 	}
26 	udelay(usecs);
27 }
28 #undef udelay
29 #define udelay(n) um_udelay(n)
30 #endif /* __UM_DELAY_H */
31