4 * Copyright (C) 2015 Yoshinori Sato
7 #include <linux/module.h>
8 #include <linux/delay.h>
10 #include <asm/processor.h>
11 #include <asm/timex.h>
13 void __delay(unsigned long cycles
)
15 __asm__
volatile ("1: dec.l #1,%0\n\t"
16 "bne 1b":"=r"(cycles
):"0"(cycles
));
18 EXPORT_SYMBOL(__delay
);
20 void __const_udelay(unsigned long xloops
)
24 loops
= (u64
)xloops
* loops_per_jiffy
* HZ
;
28 EXPORT_SYMBOL(__const_udelay
);
30 void __udelay(unsigned long usecs
)
32 __const_udelay(usecs
* 0x10C7UL
); /* 2**32 / 1000000 (rounded up) */
34 EXPORT_SYMBOL(__udelay
);
36 void __ndelay(unsigned long nsecs
)
38 __const_udelay(nsecs
* 0x5UL
); /* 2**32 / 1000000000 (rounded up) */
40 EXPORT_SYMBOL(__ndelay
);