Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
2 | * Copyright 2003 PathScale, Inc. | ||||
3 | * Copied from arch/x86_64 | ||||
4 | * | ||||
5 | * Licensed under the GPL | ||||
6 | */ | ||||
7 | |||||
Jeff Dike | 060e352 | 2005-05-20 13:59:08 -0700 | [diff] [blame] | 8 | #include <linux/module.h> |
9 | #include <linux/delay.h> | ||||
10 | #include <asm/processor.h> | ||||
11 | #include <asm/param.h> | ||||
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | |
13 | void __delay(unsigned long loops) | ||||
14 | { | ||||
15 | unsigned long i; | ||||
16 | |||||
Jeff Dike | 060e352 | 2005-05-20 13:59:08 -0700 | [diff] [blame] | 17 | for(i = 0; i < loops; i++) |
18 | cpu_relax(); | ||||
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | } |
20 | |||||
Bodo Stroesser | 5fd861b | 2005-05-05 16:15:37 -0700 | [diff] [blame] | 21 | void __udelay(unsigned long usecs) |
22 | { | ||||
Jeff Dike | 060e352 | 2005-05-20 13:59:08 -0700 | [diff] [blame] | 23 | unsigned long i, n; |
Bodo Stroesser | 5fd861b | 2005-05-05 16:15:37 -0700 | [diff] [blame] | 24 | |
25 | n = (loops_per_jiffy * HZ * usecs) / MILLION; | ||||
Jeff Dike | 060e352 | 2005-05-20 13:59:08 -0700 | [diff] [blame] | 26 | for(i=0;i<n;i++) |
27 | cpu_relax(); | ||||
Bodo Stroesser | 5fd861b | 2005-05-05 16:15:37 -0700 | [diff] [blame] | 28 | } |
29 | |||||
Jeff Dike | 060e352 | 2005-05-20 13:59:08 -0700 | [diff] [blame] | 30 | EXPORT_SYMBOL(__udelay); |