Merge branch 'clk-fixes' into clk-next
[deliverable/linux.git] / arch / h8300 / lib / delay.c
CommitLineData
a71a29de
YS
1/*
2 * delay loops
3 *
4 * Copyright (C) 2015 Yoshinori Sato
5 */
6
7#include <linux/module.h>
8#include <linux/delay.h>
9#include <asm/param.h>
10#include <asm/processor.h>
11#include <asm/timex.h>
12
13void __delay(unsigned long cycles)
14{
15 __asm__ volatile ("1: dec.l #1,%0\n\t"
16 "bne 1b":"=r"(cycles):"0"(cycles));
17}
18EXPORT_SYMBOL(__delay);
19
20void __const_udelay(unsigned long xloops)
21{
22 u64 loops;
23
24 loops = (u64)xloops * loops_per_jiffy * HZ;
25
26 __delay(loops >> 32);
27}
28EXPORT_SYMBOL(__const_udelay);
29
30void __udelay(unsigned long usecs)
31{
32 __const_udelay(usecs * 0x10C7UL); /* 2**32 / 1000000 (rounded up) */
33}
34EXPORT_SYMBOL(__udelay);
35
36void __ndelay(unsigned long nsecs)
37{
38 __const_udelay(nsecs * 0x5UL); /* 2**32 / 1000000000 (rounded up) */
39}
40EXPORT_SYMBOL(__ndelay);
This page took 0.027952 seconds and 5 git commands to generate.