Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
6bc9a396 CL |
2 | #ifndef _ASM_SCORE_DELAY_H |
3 | #define _ASM_SCORE_DELAY_H | |
4 | ||
ef8355c3 CL |
5 | #include <asm-generic/param.h> |
6 | ||
6bc9a396 CL |
7 | static inline void __delay(unsigned long loops) |
8 | { | |
0402c91a | 9 | /* 3 cycles per loop. */ |
6bc9a396 | 10 | __asm__ __volatile__ ( |
0402c91a | 11 | "1:\tsubi\t%0, 3\n\t" |
6bc9a396 | 12 | "cmpz.c\t%0\n\t" |
0402c91a | 13 | "ble\t1b\n\t" |
6bc9a396 CL |
14 | : "=r" (loops) |
15 | : "0" (loops)); | |
16 | } | |
17 | ||
18 | static inline void __udelay(unsigned long usecs) | |
19 | { | |
0402c91a CL |
20 | unsigned long loops_per_usec; |
21 | ||
22 | loops_per_usec = (loops_per_jiffy * HZ) / 1000000; | |
23 | ||
24 | __delay(usecs * loops_per_usec); | |
6bc9a396 CL |
25 | } |
26 | ||
27 | #define udelay(usecs) __udelay(usecs) | |
28 | ||
29 | #endif /* _ASM_SCORE_DELAY_H */ |