aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc/time.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-powerpc/time.h')
-rw-r--r--include/asm-powerpc/time.h31
1 files changed, 16 insertions, 15 deletions
diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h
index b051d4c88c3b..4cff977ad526 100644
--- a/include/asm-powerpc/time.h
+++ b/include/asm-powerpc/time.h
@@ -39,10 +39,6 @@ extern void generic_calibrate_decr(void);
39extern void wakeup_decrementer(void); 39extern void wakeup_decrementer(void);
40extern void snapshot_timebase(void); 40extern void snapshot_timebase(void);
41 41
42#ifdef CONFIG_RTC_CLASS
43extern int __init rtc_class_hookup(void);
44#endif
45
46/* Some sane defaults: 125 MHz timebase, 1GHz processor */ 42/* Some sane defaults: 125 MHz timebase, 1GHz processor */
47extern unsigned long ppc_proc_freq; 43extern unsigned long ppc_proc_freq;
48#define DEFAULT_PROC_FREQ (DEFAULT_TB_FREQ * 8) 44#define DEFAULT_PROC_FREQ (DEFAULT_TB_FREQ * 8)
@@ -82,30 +78,35 @@ struct div_result {
82#define __USE_RTC() 0 78#define __USE_RTC() 0
83#endif 79#endif
84 80
85/* On ppc64 this gets us the whole timebase; on ppc32 just the lower half */ 81#ifdef CONFIG_PPC64
82
83/* For compatibility, get_tbl() is defined as get_tb() on ppc64 */
84#define get_tbl get_tb
85
86#else
87
86static inline unsigned long get_tbl(void) 88static inline unsigned long get_tbl(void)
87{ 89{
88 unsigned long tbl;
89
90#if defined(CONFIG_403GCX) 90#if defined(CONFIG_403GCX)
91 unsigned long tbl;
91 asm volatile("mfspr %0, 0x3dd" : "=r" (tbl)); 92 asm volatile("mfspr %0, 0x3dd" : "=r" (tbl));
93 return tbl;
92#else 94#else
93 asm volatile("mftb %0" : "=r" (tbl)); 95 return mftbl();
94#endif 96#endif
95 return tbl;
96} 97}
97 98
98static inline unsigned int get_tbu(void) 99static inline unsigned int get_tbu(void)
99{ 100{
101#ifdef CONFIG_403GCX
100 unsigned int tbu; 102 unsigned int tbu;
101
102#if defined(CONFIG_403GCX)
103 asm volatile("mfspr %0, 0x3dc" : "=r" (tbu)); 103 asm volatile("mfspr %0, 0x3dc" : "=r" (tbu));
104 return tbu;
104#else 105#else
105 asm volatile("mftbu %0" : "=r" (tbu)); 106 return mftbu();
106#endif 107#endif
107 return tbu;
108} 108}
109#endif /* !CONFIG_PPC64 */
109 110
110static inline unsigned int get_rtcl(void) 111static inline unsigned int get_rtcl(void)
111{ 112{
@@ -131,7 +132,7 @@ static inline u64 get_tb(void)
131{ 132{
132 return mftb(); 133 return mftb();
133} 134}
134#else 135#else /* CONFIG_PPC64 */
135static inline u64 get_tb(void) 136static inline u64 get_tb(void)
136{ 137{
137 unsigned int tbhi, tblo, tbhi2; 138 unsigned int tbhi, tblo, tbhi2;
@@ -144,7 +145,7 @@ static inline u64 get_tb(void)
144 145
145 return ((u64)tbhi << 32) | tblo; 146 return ((u64)tbhi << 32) | tblo;
146} 147}
147#endif 148#endif /* !CONFIG_PPC64 */
148 149
149static inline void set_tb(unsigned int upper, unsigned int lower) 150static inline void set_tb(unsigned int upper, unsigned int lower)
150{ 151{