| .. | .. |
|---|
| 10 | 10 | #define _XTENSA_TIMEX_H |
|---|
| 11 | 11 | |
|---|
| 12 | 12 | #include <asm/processor.h> |
|---|
| 13 | | -#include <linux/stringify.h> |
|---|
| 14 | 13 | |
|---|
| 15 | 14 | #if XCHAL_NUM_TIMERS > 0 && \ |
|---|
| 16 | 15 | XTENSA_INT_LEVEL(XCHAL_TIMER0_INTERRUPT) <= XCHAL_EXCM_LEVEL |
|---|
| .. | .. |
|---|
| 30 | 29 | |
|---|
| 31 | 30 | extern unsigned long ccount_freq; |
|---|
| 32 | 31 | |
|---|
| 33 | | -typedef unsigned long long cycles_t; |
|---|
| 34 | | - |
|---|
| 35 | | -#define get_cycles() (0) |
|---|
| 36 | | - |
|---|
| 37 | 32 | void local_timer_setup(unsigned cpu); |
|---|
| 38 | 33 | |
|---|
| 39 | 34 | /* |
|---|
| 40 | 35 | * Register access. |
|---|
| 41 | 36 | */ |
|---|
| 42 | 37 | |
|---|
| 43 | | -#define WSR_CCOUNT(r) asm volatile ("wsr %0, ccount" :: "a" (r)) |
|---|
| 44 | | -#define RSR_CCOUNT(r) asm volatile ("rsr %0, ccount" : "=a" (r)) |
|---|
| 45 | | -#define WSR_CCOMPARE(x,r) asm volatile ("wsr %0,"__stringify(SREG_CCOMPARE)"+"__stringify(x) :: "a"(r)) |
|---|
| 46 | | -#define RSR_CCOMPARE(x,r) asm volatile ("rsr %0,"__stringify(SREG_CCOMPARE)"+"__stringify(x) : "=a"(r)) |
|---|
| 47 | | - |
|---|
| 48 | 38 | static inline unsigned long get_ccount (void) |
|---|
| 49 | 39 | { |
|---|
| 50 | | - unsigned long ccount; |
|---|
| 51 | | - RSR_CCOUNT(ccount); |
|---|
| 52 | | - return ccount; |
|---|
| 40 | + return xtensa_get_sr(ccount); |
|---|
| 53 | 41 | } |
|---|
| 54 | 42 | |
|---|
| 55 | 43 | static inline void set_ccount (unsigned long ccount) |
|---|
| 56 | 44 | { |
|---|
| 57 | | - WSR_CCOUNT(ccount); |
|---|
| 45 | + xtensa_set_sr(ccount, ccount); |
|---|
| 58 | 46 | } |
|---|
| 59 | 47 | |
|---|
| 60 | 48 | static inline unsigned long get_linux_timer (void) |
|---|
| 61 | 49 | { |
|---|
| 62 | | - unsigned ccompare; |
|---|
| 63 | | - RSR_CCOMPARE(LINUX_TIMER, ccompare); |
|---|
| 64 | | - return ccompare; |
|---|
| 50 | + return xtensa_get_sr(SREG_CCOMPARE + LINUX_TIMER); |
|---|
| 65 | 51 | } |
|---|
| 66 | 52 | |
|---|
| 67 | 53 | static inline void set_linux_timer (unsigned long ccompare) |
|---|
| 68 | 54 | { |
|---|
| 69 | | - WSR_CCOMPARE(LINUX_TIMER, ccompare); |
|---|
| 55 | + xtensa_set_sr(ccompare, SREG_CCOMPARE + LINUX_TIMER); |
|---|
| 70 | 56 | } |
|---|
| 71 | 57 | |
|---|
| 58 | +#include <asm-generic/timex.h> |
|---|
| 59 | + |
|---|
| 72 | 60 | #endif /* _XTENSA_TIMEX_H */ |
|---|