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.h27
1 files changed, 16 insertions, 11 deletions
diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h
index b051d4c88c3b..a78285010d62 100644
--- a/include/asm-powerpc/time.h
+++ b/include/asm-powerpc/time.h
@@ -82,30 +82,35 @@ struct div_result {
82#define __USE_RTC() 0 82#define __USE_RTC() 0
83#endif 83#endif
84 84
85/* On ppc64 this gets us the whole timebase; on ppc32 just the lower half */ 85#ifdef CONFIG_PPC64
86
87/* For compatibility, get_tbl() is defined as get_tb() on ppc64 */
88#define get_tbl get_tb
89
90#else
91
86static inline unsigned long get_tbl(void) 92static inline unsigned long get_tbl(void)
87{ 93{
88 unsigned long tbl;
89
90#if defined(CONFIG_403GCX) 94#if defined(CONFIG_403GCX)
95 unsigned long tbl;
91 asm volatile("mfspr %0, 0x3dd" : "=r" (tbl)); 96 asm volatile("mfspr %0, 0x3dd" : "=r" (tbl));
97 return tbl;
92#else 98#else
93 asm volatile("mftb %0" : "=r" (tbl)); 99 return mftbl();
94#endif 100#endif
95 return tbl;
96} 101}
97 102
98static inline unsigned int get_tbu(void) 103static inline unsigned int get_tbu(void)
99{ 104{
105#ifdef CONFIG_403GCX
100 unsigned int tbu; 106 unsigned int tbu;
101
102#if defined(CONFIG_403GCX)
103 asm volatile("mfspr %0, 0x3dc" : "=r" (tbu)); 107 asm volatile("mfspr %0, 0x3dc" : "=r" (tbu));
108 return tbu;
104#else 109#else
105 asm volatile("mftbu %0" : "=r" (tbu)); 110 return mftbu();
106#endif 111#endif
107 return tbu;
108} 112}
113#endif /* !CONFIG_PPC64 */
109 114
110static inline unsigned int get_rtcl(void) 115static inline unsigned int get_rtcl(void)
111{ 116{
@@ -131,7 +136,7 @@ static inline u64 get_tb(void)
131{ 136{
132 return mftb(); 137 return mftb();
133} 138}
134#else 139#else /* CONFIG_PPC64 */
135static inline u64 get_tb(void) 140static inline u64 get_tb(void)
136{ 141{
137 unsigned int tbhi, tblo, tbhi2; 142 unsigned int tbhi, tblo, tbhi2;
@@ -144,7 +149,7 @@ static inline u64 get_tb(void)
144 149
145 return ((u64)tbhi << 32) | tblo; 150 return ((u64)tbhi << 32) | tblo;
146} 151}
147#endif 152#endif /* !CONFIG_PPC64 */
148 153
149static inline void set_tb(unsigned int upper, unsigned int lower) 154static inline void set_tb(unsigned int upper, unsigned int lower)
150{ 155{