~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to arch/mips/include/asm/timex.h

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 */
21
21
#define CLOCK_TICK_RATE 1193182
22
22
 
23
 
extern unsigned int mips_hpt_frequency;
24
 
 
25
23
/*
26
24
 * Standard way to access the cycle counter.
27
25
 * Currently only used on SMP for scheduling.
31
29
 * which isn't an evil thing.
32
30
 *
33
31
 * We know that all SMP capable CPUs have cycle counters.
34
 
 *
35
 
 * Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
36
 
 * HAVE_GET_CYCLES makes sure that this case is handled properly :
37
 
 *
38
 
 * Ralf Baechle <ralf@linux-mips.org> :
39
 
 * This avoids us executing an mfc0 c0_count instruction on processors which
40
 
 * don't have but also on certain R4000 and R4400 versions where reading from
41
 
 * the count register just in the very moment when its value equals c0_compare
42
 
 * will result in the timer interrupt getting lost.
43
 
 */
44
 
 
45
 
#ifdef CONFIG_HAVE_GET_CYCLES
46
 
# ifdef CONFIG_CPU_CAVIUM_OCTEON
47
 
typedef unsigned long cycles_t;
48
 
 
49
 
static inline cycles_t get_cycles(void)
50
 
{
51
 
        return read_c0_cvmcount();
52
 
}
53
 
 
54
 
static inline void get_cycles_barrier(void)
55
 
{
56
 
}
57
 
 
58
 
static inline cycles_t get_cycles_rate(void)
59
 
{
60
 
        return mips_hpt_frequency;
61
 
}
62
 
 
63
 
extern int test_tsc_synchronization(void);
64
 
extern int _tsc_is_sync;
65
 
static inline int tsc_is_sync(void)
66
 
{
67
 
        return _tsc_is_sync;
68
 
}
69
 
# else /* #ifdef CONFIG_CPU_CAVIUM_OCTEON */
70
 
#  error "64-bit get_cycles() supported only on Cavium Octeon MIPS architectures"
71
 
# endif /* #else #ifdef CONFIG_CPU_CAVIUM_OCTEON */
72
 
#elif defined(CONFIG_HAVE_GET_CYCLES_32)
73
 
typedef unsigned int cycles_t;
74
 
 
75
 
static inline cycles_t get_cycles(void)
76
 
{
77
 
        return read_c0_count();
78
 
}
79
 
 
80
 
static inline void get_cycles_barrier(void)
81
 
{
82
 
}
83
 
 
84
 
static inline cycles_t get_cycles_rate(void)
85
 
{
86
 
        return mips_hpt_frequency;
87
 
}
88
 
 
89
 
extern int test_tsc_synchronization(void);
90
 
extern int _tsc_is_sync;
91
 
static inline int tsc_is_sync(void)
92
 
{
93
 
        return _tsc_is_sync;
94
 
}
95
 
#else
96
 
typedef unsigned int cycles_t;
97
 
 
98
 
static inline cycles_t get_cycles(void)
99
 
{
100
 
        return 0;
101
 
}
102
 
static inline int test_tsc_synchronization(void)
103
 
{
104
 
        return 0;
105
 
}
106
 
static inline int tsc_is_sync(void)
107
 
{
108
 
        return 0;
109
 
}
110
 
#endif
111
 
 
112
 
#define DELAY_INTERRUPT 100
113
 
/*
114
 
 * Only updates 32 LSB.
115
 
 */
116
 
static inline void write_tsc(u32 val1, u32 val2)
117
 
{
118
 
        write_c0_count(val1);
119
 
        /* Arrange for an interrupt in a short while */
120
 
        write_c0_compare(read_c0_count() + DELAY_INTERRUPT);
121
 
}
122
 
 
123
 
/*
124
 
 * Currently unused, should update internal tsc-related timekeeping sources.
125
 
 */
126
 
static inline void mark_tsc_unstable(char *reason)
127
 
{
128
 
}
129
 
 
130
 
/*
131
 
 * Currently simply use the tsc_is_sync value.
132
 
 */
133
 
static inline int unsynchronized_tsc(void)
134
 
{
135
 
        return !tsc_is_sync();
 
32
 */
 
33
 
 
34
typedef unsigned int cycles_t;
 
35
 
 
36
static inline cycles_t get_cycles(void)
 
37
{
 
38
        return 0;
136
39
}
137
40
 
138
41
#endif /* __KERNEL__ */