xtensa: timex.h: remove unused symbols
[linux-2.6-block.git] / arch / xtensa / include / asm / timex.h
CommitLineData
9a8fd558
CZ
1/*
2 * include/asm-xtensa/timex.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
2d1c645c 8 * Copyright (C) 2001 - 2008 Tensilica Inc.
9a8fd558
CZ
9 */
10
11#ifndef _XTENSA_TIMEX_H
12#define _XTENSA_TIMEX_H
13
14#ifdef __KERNEL__
15
16#include <asm/processor.h>
17#include <linux/stringify.h>
18
173d6681
CZ
19#define _INTLEVEL(x) XCHAL_INT ## x ## _LEVEL
20#define INTLEVEL(x) _INTLEVEL(x)
21
0f7f9310
MF
22#if XCHAL_NUM_TIMERS > 0 && \
23 INTLEVEL(XCHAL_TIMER0_INTERRUPT) <= XCHAL_EXCM_LEVEL
9a8fd558 24# define LINUX_TIMER 0
173d6681 25# define LINUX_TIMER_INT XCHAL_TIMER0_INTERRUPT
0f7f9310
MF
26#elif XCHAL_NUM_TIMERS > 1 && \
27 INTLEVEL(XCHAL_TIMER1_INTERRUPT) <= XCHAL_EXCM_LEVEL
9a8fd558 28# define LINUX_TIMER 1
173d6681 29# define LINUX_TIMER_INT XCHAL_TIMER1_INTERRUPT
0f7f9310
MF
30#elif XCHAL_NUM_TIMERS > 2 && \
31 INTLEVEL(XCHAL_TIMER2_INTERRUPT) <= XCHAL_EXCM_LEVEL
9a8fd558 32# define LINUX_TIMER 2
173d6681 33# define LINUX_TIMER_INT XCHAL_TIMER2_INTERRUPT
9a8fd558
CZ
34#else
35# error "Bad timer number for Linux configurations!"
36#endif
37
9a8fd558
CZ
38#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
39extern unsigned long ccount_per_jiffy;
d15f05eb 40extern unsigned long nsec_per_ccount;
9a8fd558 41#define CCOUNT_PER_JIFFY ccount_per_jiffy
9a8fd558
CZ
42#else
43#define CCOUNT_PER_JIFFY (CONFIG_XTENSA_CPU_CLOCK*(1000000UL/HZ))
9a8fd558
CZ
44#endif
45
46
47typedef unsigned long long cycles_t;
48
49/*
50 * Only used for SMP.
51 */
52
53extern cycles_t cacheflush_time;
54
55#define get_cycles() (0)
56
57
58/*
59 * Register access.
60 */
61
bc5378fc
MF
62#define WSR_CCOUNT(r) asm volatile ("wsr %0, ccount" :: "a" (r))
63#define RSR_CCOUNT(r) asm volatile ("rsr %0, ccount" : "=a" (r))
64#define WSR_CCOMPARE(x,r) asm volatile ("wsr %0,"__stringify(SREG_CCOMPARE)"+"__stringify(x) :: "a"(r))
65#define RSR_CCOMPARE(x,r) asm volatile ("rsr %0,"__stringify(SREG_CCOMPARE)"+"__stringify(x) : "=a"(r))
9a8fd558
CZ
66
67static inline unsigned long get_ccount (void)
68{
69 unsigned long ccount;
70 RSR_CCOUNT(ccount);
71 return ccount;
72}
73
74static inline void set_ccount (unsigned long ccount)
75{
76 WSR_CCOUNT(ccount);
77}
78
79static inline unsigned long get_linux_timer (void)
80{
81 unsigned ccompare;
82 RSR_CCOMPARE(LINUX_TIMER, ccompare);
83 return ccompare;
84}
85
86static inline void set_linux_timer (unsigned long ccompare)
87{
88 WSR_CCOMPARE(LINUX_TIMER, ccompare);
89}
90
91#endif /* __KERNEL__ */
92#endif /* _XTENSA_TIMEX_H */