x86, efi: Set runtime_version to the EFI spec revision
[linux/fpc-iii.git] / arch / arm64 / lib / delay.c
blobdad4ec9bbfd1e8c7298ca43d3c0d2e25d177c725
1 /*
2 * Delay loops based on the OpenRISC implementation.
4 * Copyright (C) 2012 ARM Limited
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 * Author: Will Deacon <will.deacon@arm.com>
21 #include <linux/delay.h>
22 #include <linux/init.h>
23 #include <linux/kernel.h>
24 #include <linux/module.h>
25 #include <linux/timex.h>
27 void __delay(unsigned long cycles)
29 cycles_t start = get_cycles();
31 while ((get_cycles() - start) < cycles)
32 cpu_relax();
34 EXPORT_SYMBOL(__delay);
36 inline void __const_udelay(unsigned long xloops)
38 unsigned long loops;
40 loops = xloops * loops_per_jiffy * HZ;
41 __delay(loops >> 32);
43 EXPORT_SYMBOL(__const_udelay);
45 void __udelay(unsigned long usecs)
47 __const_udelay(usecs * 0x10C7UL); /* 2**32 / 1000000 (rounded up) */
49 EXPORT_SYMBOL(__udelay);
51 void __ndelay(unsigned long nsecs)
53 __const_udelay(nsecs * 0x5UL); /* 2**32 / 1000000000 (rounded up) */
55 EXPORT_SYMBOL(__ndelay);