xref: /linux/arch/loongarch/include/asm/delay.h (revision f9bff0e31881d03badf191d3b0005839391f5f2b)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
4  */
5 #ifndef _ASM_DELAY_H
6 #define _ASM_DELAY_H
7 
8 #include <linux/param.h>
9 
10 extern void __delay(unsigned long cycles);
11 extern void __ndelay(unsigned long ns);
12 extern void __udelay(unsigned long us);
13 
14 #define ndelay(ns) __ndelay(ns)
15 #define udelay(us) __udelay(us)
16 
17 /* make sure "usecs *= ..." in udelay do not overflow. */
18 #if HZ >= 1000
19 #define MAX_UDELAY_MS	1
20 #elif HZ <= 200
21 #define MAX_UDELAY_MS	5
22 #else
23 #define MAX_UDELAY_MS	(1000 / HZ)
24 #endif
25 
26 #endif /* _ASM_DELAY_H */
27