]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blob - arch/h8300/lib/delay.c
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[mirror_ubuntu-jammy-kernel.git] / arch / h8300 / lib / delay.c
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * delay loops
4 *
5 * Copyright (C) 2015 Yoshinori Sato
6 */
7
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>
13
14 void __delay(unsigned long cycles)
15 {
16 __asm__ volatile ("1: dec.l #1,%0\n\t"
17 "bne 1b":"=r"(cycles):"0"(cycles));
18 }
19 EXPORT_SYMBOL(__delay);
20
21 void __const_udelay(unsigned long xloops)
22 {
23 u64 loops;
24
25 loops = (u64)xloops * loops_per_jiffy * HZ;
26
27 __delay(loops >> 32);
28 }
29 EXPORT_SYMBOL(__const_udelay);
30
31 void __udelay(unsigned long usecs)
32 {
33 __const_udelay(usecs * 0x10C7UL); /* 2**32 / 1000000 (rounded up) */
34 }
35 EXPORT_SYMBOL(__udelay);
36
37 void __ndelay(unsigned long nsecs)
38 {
39 __const_udelay(nsecs * 0x5UL); /* 2**32 / 1000000000 (rounded up) */
40 }
41 EXPORT_SYMBOL(__ndelay);