2 * Copyright (C) 2011 Richard Weinberger <richrd@nod.at>
3 * Mostly copied from arch/x86/lib/delay.c
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
10 #include <linux/export.h>
11 #include <linux/kernel.h>
12 #include <linux/delay.h>
13 #include <asm/param.h>
15 void __delay(unsigned long loops)
30 : /* we don't need output */
34 EXPORT_SYMBOL(__delay);
36 inline void __const_udelay(unsigned long xloops)
42 : "=d" (xloops), "=&a" (d0)
44 (loops_per_jiffy * (HZ/4)));
48 EXPORT_SYMBOL(__const_udelay);
50 void __udelay(unsigned long usecs)
52 __const_udelay(usecs * 0x000010c7); /* 2**32 / 1000000 (rounded up) */
54 EXPORT_SYMBOL(__udelay);
56 void __ndelay(unsigned long nsecs)
58 __const_udelay(nsecs * 0x00005); /* 2**32 / 1000000000 (rounded up) */
60 EXPORT_SYMBOL(__ndelay);