1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (C) 2015 Yoshinori Sato
8 #include <linux/module.h>
9 #include <linux/delay.h>
10 #include <asm/param.h>
11 #include <asm/processor.h>
12 #include <asm/timex.h>
14 void __delay(unsigned long cycles
)
16 __asm__
volatile ("1: dec.l #1,%0\n\t"
17 "bne 1b":"=r"(cycles
):"0"(cycles
));
19 EXPORT_SYMBOL(__delay
);
21 void __const_udelay(unsigned long xloops
)
25 loops
= (u64
)xloops
* loops_per_jiffy
* HZ
;
29 EXPORT_SYMBOL(__const_udelay
);
31 void __udelay(unsigned long usecs
)
33 __const_udelay(usecs
* 0x10C7UL
); /* 2**32 / 1000000 (rounded up) */
35 EXPORT_SYMBOL(__udelay
);
37 void __ndelay(unsigned long nsecs
)
39 __const_udelay(nsecs
* 0x5UL
); /* 2**32 / 1000000000 (rounded up) */
41 EXPORT_SYMBOL(__ndelay
);