diff options
author | James Hogan | 2012-10-09 11:54:39 +0200 |
---|---|---|
committer | James Hogan | 2013-03-02 21:09:22 +0100 |
commit | a2c5d4ed92bbc02ff4a37efc2adffe7d145abe4f (patch) | |
tree | 21fc65e4f0b04928025565f208a410a7a64ab523 /arch/metag/include/asm/delay.h | |
parent | metag: ptrace (diff) | |
download | kernel-qcow2-linux-a2c5d4ed92bbc02ff4a37efc2adffe7d145abe4f.tar.gz kernel-qcow2-linux-a2c5d4ed92bbc02ff4a37efc2adffe7d145abe4f.tar.xz kernel-qcow2-linux-a2c5d4ed92bbc02ff4a37efc2adffe7d145abe4f.zip |
metag: Time keeping
Add time keeping code for metag. Meta hardware threads have 2 timers.
The background timer (TXTIMER) is used as a free-running time base, and
the interrupt timer (TXTIMERI) is used for the timer interrupt. Both
counters traditionally count at approximately 1MHz.
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: John Stultz <johnstul@us.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/metag/include/asm/delay.h')
-rw-r--r-- | arch/metag/include/asm/delay.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/metag/include/asm/delay.h b/arch/metag/include/asm/delay.h new file mode 100644 index 000000000000..9c92f996957a --- /dev/null +++ b/arch/metag/include/asm/delay.h @@ -0,0 +1,29 @@ +#ifndef _METAG_DELAY_H +#define _METAG_DELAY_H + +/* + * Copyright (C) 1993 Linus Torvalds + * + * Delay routines calling functions in arch/metag/lib/delay.c + */ + +/* Undefined functions to get compile-time errors */ +extern void __bad_udelay(void); +extern void __bad_ndelay(void); + +extern void __udelay(unsigned long usecs); +extern void __ndelay(unsigned long nsecs); +extern void __const_udelay(unsigned long xloops); +extern void __delay(unsigned long loops); + +/* 0x10c7 is 2**32 / 1000000 (rounded up) */ +#define udelay(n) (__builtin_constant_p(n) ? \ + ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c7ul)) : \ + __udelay(n)) + +/* 0x5 is 2**32 / 1000000000 (rounded up) */ +#define ndelay(n) (__builtin_constant_p(n) ? \ + ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \ + __ndelay(n)) + +#endif /* _METAG_DELAY_H */ |