aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-ppc/time.h
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2008-06-09 00:01:46 -0400
committerPaul Mackerras <paulus@samba.org>2008-06-10 07:40:22 -0400
commit917f0af9e5a9ceecf9e72537fabb501254ba321d (patch)
tree1ef207755c6d83ce4af93ef2b5e4645eebd65886 /include/asm-ppc/time.h
parent0f3d6bcd391b058c619fc30e8022e8a29fbf4bef (diff)
powerpc: Remove arch/ppc and include/asm-ppc
All the maintained platforms are now in arch/powerpc, so the old arch/ppc stuff can now go away. Acked-by: Adrian Bunk <bunk@kernel.org> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Becky Bruce <becky.bruce@freescale.com> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Jochen Friedrich <jochen@scram.de> Acked-by: John Linn <john.linn@xilinx.com> Acked-by: Jon Loeliger <jdl@freescale.com> Acked-by: Josh Boyer <jwboyer@linux.vnet.ibm.com> Acked-by: Kumar Gala <galak@kernel.crashing.org> Acked-by: Olof Johansson <olof@lixom.net> Acked-by: Peter Korsgaard <jacmet@sunsite.dk> Acked-by: Scott Wood <scottwood@freescale.com> Acked-by: Sean MacLennan <smaclennan@pikatech.com> Acked-by: Segher Boessenkool <segher@kernel.crashing.org> Acked-by: Stefan Roese <sr@denx.de> Acked-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com> Acked-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/asm-ppc/time.h')
-rw-r--r--include/asm-ppc/time.h161
1 files changed, 0 insertions, 161 deletions
diff --git a/include/asm-ppc/time.h b/include/asm-ppc/time.h
deleted file mode 100644
index 81dbcd43a501..000000000000
--- a/include/asm-ppc/time.h
+++ /dev/null
@@ -1,161 +0,0 @@
1/*
2 * Common time prototypes and such for all ppc machines.
3 *
4 * Written by Cort Dougan (cort@fsmlabs.com) to merge
5 * Paul Mackerras' version and mine for PReP and Pmac.
6 */
7
8#ifdef __KERNEL__
9#ifndef __ASM_TIME_H__
10#define __ASM_TIME_H__
11
12#include <linux/types.h>
13#include <linux/rtc.h>
14#include <linux/threads.h>
15
16#include <asm/reg.h>
17
18/* time.c */
19extern unsigned tb_ticks_per_jiffy;
20extern unsigned tb_to_us;
21extern unsigned tb_last_stamp;
22extern unsigned long disarm_decr[NR_CPUS];
23
24extern void to_tm(int tim, struct rtc_time * tm);
25extern time_t last_rtc_update;
26
27extern void set_dec_cpu6(unsigned int val);
28
29int via_calibrate_decr(void);
30
31/* Accessor functions for the decrementer register.
32 * The 4xx doesn't even have a decrementer. I tried to use the
33 * generic timer interrupt code, which seems OK, with the 4xx PIT
34 * in auto-reload mode. The problem is PIT stops counting when it
35 * hits zero. If it would wrap, we could use it just like a decrementer.
36 */
37static __inline__ unsigned int get_dec(void)
38{
39#if defined(CONFIG_40x)
40 return (mfspr(SPRN_PIT));
41#else
42 return (mfspr(SPRN_DEC));
43#endif
44}
45
46static __inline__ void set_dec(unsigned int val)
47{
48#if defined(CONFIG_40x)
49 return; /* Have to let it auto-reload */
50#elif defined(CONFIG_8xx_CPU6)
51 set_dec_cpu6(val);
52#else
53 mtspr(SPRN_DEC, val);
54#endif
55}
56
57/* Accessor functions for the timebase (RTC on 601) registers. */
58/* If one day CONFIG_POWER is added just define __USE_RTC as 1 */
59#ifdef CONFIG_6xx
60extern __inline__ int __pure __USE_RTC(void) {
61 return (mfspr(SPRN_PVR)>>16) == 1;
62}
63#else
64#define __USE_RTC() 0
65#endif
66
67extern __inline__ unsigned long get_tbl(void) {
68 unsigned long tbl;
69#if defined(CONFIG_403GCX)
70 asm volatile("mfspr %0, 0x3dd" : "=r" (tbl));
71#else
72 asm volatile("mftb %0" : "=r" (tbl));
73#endif
74 return tbl;
75}
76
77extern __inline__ unsigned long get_tbu(void) {
78 unsigned long tbl;
79#if defined(CONFIG_403GCX)
80 asm volatile("mfspr %0, 0x3dc" : "=r" (tbl));
81#else
82 asm volatile("mftbu %0" : "=r" (tbl));
83#endif
84 return tbl;
85}
86
87extern __inline__ void set_tb(unsigned int upper, unsigned int lower)
88{
89 mtspr(SPRN_TBWL, 0);
90 mtspr(SPRN_TBWU, upper);
91 mtspr(SPRN_TBWL, lower);
92}
93
94extern __inline__ unsigned long get_rtcl(void) {
95 unsigned long rtcl;
96 asm volatile("mfrtcl %0" : "=r" (rtcl));
97 return rtcl;
98}
99
100extern __inline__ unsigned long get_rtcu(void)
101{
102 unsigned long rtcu;
103 asm volatile("mfrtcu %0" : "=r" (rtcu));
104 return rtcu;
105}
106
107extern __inline__ unsigned get_native_tbl(void) {
108 if (__USE_RTC())
109 return get_rtcl();
110 else
111 return get_tbl();
112}
113
114/* On machines with RTC, this function can only be used safely
115 * after the timestamp and for 1 second. It is only used by gettimeofday
116 * however so it should not matter.
117 */
118extern __inline__ unsigned tb_ticks_since(unsigned tstamp) {
119 if (__USE_RTC()) {
120 int delta = get_rtcl() - tstamp;
121 return delta<0 ? delta + 1000000000 : delta;
122 } else {
123 return get_tbl() - tstamp;
124 }
125}
126
127#if 0
128extern __inline__ unsigned long get_bin_rtcl(void) {
129 unsigned long rtcl, rtcu1, rtcu2;
130 asm volatile("\
1311: mfrtcu %0\n\
132 mfrtcl %1\n\
133 mfrtcu %2\n\
134 cmpw %0,%2\n\
135 bne- 1b\n"
136 : "=r" (rtcu1), "=r" (rtcl), "=r" (rtcu2)
137 : : "cr0");
138 return rtcu2*1000000000+rtcl;
139}
140
141extern __inline__ unsigned binary_tbl(void) {
142 if (__USE_RTC())
143 return get_bin_rtcl();
144 else
145 return get_tbl();
146}
147#endif
148
149/* Use mulhwu to scale processor timebase to timeval */
150/* Specifically, this computes (x * y) / 2^32. -- paulus */
151#define mulhwu(x,y) \
152({unsigned z; asm ("mulhwu %0,%1,%2" : "=r" (z) : "r" (x), "r" (y)); z;})
153
154unsigned mulhwu_scale_factor(unsigned, unsigned);
155
156#define account_process_vtime(tsk) do { } while (0)
157#define calculate_steal_time() do { } while (0)
158#define snapshot_timebases() do { } while (0)
159
160#endif /* __ASM_TIME_H__ */
161#endif /* __KERNEL__ */