2 * delay.h - delay functions
4 * Copyright (c) 2004-2007 Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
9 #ifndef __ASM_DELAY_H__
10 #define __ASM_DELAY_H__
12 #include <mach/anomaly.h>
14 static inline void __delay(unsigned long loops
)
16 if (ANOMALY_05000312
) {
17 /* Interrupted loads to loop registers -> bad */
23 "LSETUP (1f,1f) LC0 = %1;"
25 /* We take advantage of the fact that LC0 is 0 at
26 * the end of the loop. Otherwise we'd need some
27 * NOPs after the CLI here.
38 __asm__
__volatile__ (
39 "LSETUP(1f, 1f) LC0 = %0;"
47 #include <linux/param.h> /* needed for HZ */
50 * Use only for very small delays ( < 1 msec). Should probably use a
51 * lookup table, really, as the multiplications take much too long with
52 * short delays. This is a "reasonable" implementation, though (and the
53 * first constant multiplications gets optimized away if the delay is
56 static inline void udelay(unsigned long usecs
)
58 extern unsigned long loops_per_jiffy
;
59 __delay(usecs
* loops_per_jiffy
/ (1000000 / HZ
));