aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/mips/time.README
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/mips/time.README')
-rw-r--r--Documentation/mips/time.README49
1 files changed, 13 insertions, 36 deletions
diff --git a/Documentation/mips/time.README b/Documentation/mips/time.README
index 69ddc5c14b79..a4ce603ed3b3 100644
--- a/Documentation/mips/time.README
+++ b/Documentation/mips/time.README
@@ -38,19 +38,14 @@ The new time code provide the following services:
38 38
39 a) Implements functions required by Linux common code: 39 a) Implements functions required by Linux common code:
40 time_init 40 time_init
41 do_gettimeofday
42 do_settimeofday
43 41
44 b) provides an abstraction of RTC and null RTC implementation as default. 42 b) provides an abstraction of RTC and null RTC implementation as default.
45 extern unsigned long (*rtc_get_time)(void); 43 extern unsigned long (*rtc_get_time)(void);
46 extern int (*rtc_set_time)(unsigned long); 44 extern int (*rtc_set_time)(unsigned long);
47 45
48 c) a set of gettimeoffset functions for different CPUs and different 46 c) high-level and low-level timer interrupt routines where the timer
49 needs. 47 interrupt source may or may not be the CPU timer. The high-level
50 48 routine is dispatched through do_IRQ() while the low-level is
51 d) high-level and low-level timer interrupt routines where the timer
52 interrupt source may or may not be the CPU timer. The high-level
53 routine is dispatched through do_IRQ() while the low-level is
54 dispatched in assemably code (usually int-handler.S) 49 dispatched in assemably code (usually int-handler.S)
55 50
56 51
@@ -63,7 +58,7 @@ the following functions or values:
63 a) board_time_init - a function pointer. Invoked at the beginnig of 58 a) board_time_init - a function pointer. Invoked at the beginnig of
64 time_init(). It is optional. 59 time_init(). It is optional.
65 1. (optional) set up RTC routines 60 1. (optional) set up RTC routines
66 2. (optional) calibrate and set the mips_counter_frequency 61 2. (optional) calibrate and set the mips_hpt_frequency
67 62
68 b) plat_timer_setup - a function pointer. Invoked at the end of time_init() 63 b) plat_timer_setup - a function pointer. Invoked at the end of time_init()
69 1. (optional) over-ride any decisions made in time_init() 64 1. (optional) over-ride any decisions made in time_init()
@@ -72,9 +67,8 @@ the following functions or values:
72 67
73 c) (optional) board-specific RTC routines. 68 c) (optional) board-specific RTC routines.
74 69
75 d) (optional) mips_counter_frequency - It must be definied if the board 70 d) (optional) mips_hpt_frequency - It must be definied if the board
76 is using CPU counter for timer interrupt or it is using fixed rate 71 is using CPU counter for timer interrupt.
77 gettimeoffset().
78 72
79 73
80PORTING GUIDE 74PORTING GUIDE
@@ -89,22 +83,12 @@ Step 1: decide how you like to implement the time services.
89 If the answer is no, you need a timer to provide the timer interrupt 83 If the answer is no, you need a timer to provide the timer interrupt
90 at 100 HZ speed. 84 at 100 HZ speed.
91 85
92 You cannot use the fast gettimeoffset functions, i.e.,
93
94 unsigned long fixed_rate_gettimeoffset(void);
95 unsigned long calibrate_div32_gettimeoffset(void);
96 unsigned long calibrate_div64_gettimeoffset(void);
97
98 You can use null_gettimeoffset() will gives the same time resolution as
99 jiffy. Or you can implement your own gettimeoffset (probably based on
100 some ad hoc hardware on your machine.)
101
102 c) The following sub steps assume your CPU has counter register. 86 c) The following sub steps assume your CPU has counter register.
103 Do you plan to use the CPU counter register as the timer interrupt 87 Do you plan to use the CPU counter register as the timer interrupt
104 or use an exnternal timer? 88 or use an exnternal timer?
105 89
106 In order to use CPU counter register as the timer interrupt source, you 90 In order to use CPU counter register as the timer interrupt source, you
107 must know the counter speed (mips_counter_frequency). It is usually the 91 must know the counter speed (mips_hpt_frequency). It is usually the
108 same as the CPU speed or an integral divisor of it. 92 same as the CPU speed or an integral divisor of it.
109 93
110 d) decide on whether you want to use high-level or low-level timer 94 d) decide on whether you want to use high-level or low-level timer
@@ -121,10 +105,10 @@ Step 3: implement rtc routines, board_time_init() and plat_timer_setup()
121 if needed. 105 if needed.
122 106
123 board_time_init() - 107 board_time_init() -
124 a) (optional) set up RTC routines, 108 a) (optional) set up RTC routines,
125 b) (optional) calibrate and set the mips_counter_frequency 109 b) (optional) calibrate and set the mips_hpt_frequency
126 (only needed if you intended to use fixed_rate_gettimeoffset 110 (only needed if you intended to use cpu counter as timer interrupt
127 or use cpu counter as timer interrupt source) 111 source)
128 112
129 plat_timer_setup() - 113 plat_timer_setup() -
130 a) (optional) over-write any choices made above by time_init(). 114 a) (optional) over-write any choices made above by time_init().
@@ -154,8 +138,8 @@ for some of the functions in time.c.
154For example, you may define your own timer interrupt routine, which does 138For example, you may define your own timer interrupt routine, which does
155some of its own processing and then calls timer_interrupt(). 139some of its own processing and then calls timer_interrupt().
156 140
157You can also over-ride any of the built-in functions (gettimeoffset, 141You can also over-ride any of the built-in functions (RTC routines
158RTC routines and/or timer interrupt routine). 142and/or timer interrupt routine).
159 143
160 144
161PORTING NOTES FOR SMP 145PORTING NOTES FOR SMP
@@ -187,10 +171,3 @@ You need to decide on your timer interrupt sources.
187 171
188 You can also do the low-level version of those interrupt routines, 172 You can also do the low-level version of those interrupt routines,
189 following similar dispatching routes described above. 173 following similar dispatching routes described above.
190
191Note about do_gettimeoffset():
192
193 It is very likely the CPU counter registers are not sync'ed up in a SMP box.
194 Therefore you cannot really use the many of the existing routines that
195 are based on CPU counter. You should wirte your own gettimeoffset rouinte
196 if you want intra-jiffy resolution.