diff options
author | Ben Dooks <ben-linux@fluff.org> | 2008-10-21 11:12:00 +0100 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2008-10-21 11:12:00 +0100 |
commit | c3380942e6699ed5b3e3f37b49ceb724b7699813 (patch) | |
tree | 516d791cdfd1c7f99a29f71e1a7bba8f75af96e1 /arch/parisc/include/asm/delay.h | |
parent | 0ffda6cca2c66e42d0ad65719f58c637ed180b05 (diff) | |
parent | 2515ddc6db8eb49a79f0fe5e67ff09ac7c81eab4 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into s3c64xx
Diffstat (limited to 'arch/parisc/include/asm/delay.h')
-rw-r--r-- | arch/parisc/include/asm/delay.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/arch/parisc/include/asm/delay.h b/arch/parisc/include/asm/delay.h new file mode 100644 index 00000000000..7a75e984674 --- /dev/null +++ b/arch/parisc/include/asm/delay.h @@ -0,0 +1,43 @@ +#ifndef _PARISC_DELAY_H +#define _PARISC_DELAY_H + +#include <asm/system.h> /* for mfctl() */ +#include <asm/processor.h> /* for boot_cpu_data */ + + +/* + * Copyright (C) 1993 Linus Torvalds + * + * Delay routines + */ + +static __inline__ void __delay(unsigned long loops) { + asm volatile( + " .balignl 64,0x34000034\n" + " addib,UV -1,%0,.\n" + " nop\n" + : "=r" (loops) : "0" (loops)); +} + +static __inline__ void __cr16_delay(unsigned long clocks) { + unsigned long start; + + /* + * Note: Due to unsigned math, cr16 rollovers shouldn't be + * a problem here. However, on 32 bit, we need to make sure + * we don't pass in too big a value. The current default + * value of MAX_UDELAY_MS should help prevent this. + */ + + start = mfctl(16); + while ((mfctl(16) - start) < clocks) + ; +} + +static __inline__ void __udelay(unsigned long usecs) { + __cr16_delay(usecs * ((unsigned long)boot_cpu_data.cpu_hz / 1000000UL)); +} + +#define udelay(n) __udelay(n) + +#endif /* defined(_PARISC_DELAY_H) */ |