File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -171,25 +171,48 @@ struct clocksource clocksource_mips = {
171171 .flags = CLOCK_SOURCE_IS_CONTINUOUS ,
172172};
173173
174- static void __init init_mips_clocksource ( void )
174+ void __init clocksource_set_clock ( struct clocksource * cs , unsigned int clock )
175175{
176176 u64 temp ;
177177 u32 shift ;
178178
179- if (!mips_hpt_frequency || clocksource_mips .read == null_hpt_read )
180- return ;
179+ /* Find a shift value */
180+ for (shift = 32 ; shift > 0 ; shift -- ) {
181+ temp = (u64 ) NSEC_PER_SEC << shift ;
182+ do_div (temp , clock );
183+ if ((temp >> 32 ) == 0 )
184+ break ;
185+ }
186+ cs -> shift = shift ;
187+ cs -> mult = (u32 ) temp ;
188+ }
189+
190+ void __cpuinit clockevent_set_clock (struct clock_event_device * cd ,
191+ unsigned int clock )
192+ {
193+ u64 temp ;
194+ u32 shift ;
181195
182- /* Calclate a somewhat reasonable rating value */
183- clocksource_mips .rating = 200 + mips_hpt_frequency / 10000000 ;
184196 /* Find a shift value */
185197 for (shift = 32 ; shift > 0 ; shift -- ) {
186198 temp = (u64 ) NSEC_PER_SEC << shift ;
187- do_div (temp , mips_hpt_frequency );
199+ do_div (temp , clock );
188200 if ((temp >> 32 ) == 0 )
189201 break ;
190202 }
191- clocksource_mips .shift = shift ;
192- clocksource_mips .mult = (u32 )temp ;
203+ cd -> shift = shift ;
204+ cd -> mult = (u32 ) temp ;
205+ }
206+
207+ static void __init init_mips_clocksource (void )
208+ {
209+ if (!mips_hpt_frequency || clocksource_mips .read == null_hpt_read )
210+ return ;
211+
212+ /* Calclate a somewhat reasonable rating value */
213+ clocksource_mips .rating = 200 + mips_hpt_frequency / 10000000 ;
214+
215+ clocksource_set_clock (& clocksource_mips , mips_hpt_frequency );
193216
194217 clocksource_register (& clocksource_mips );
195218}
Original file line number Diff line number Diff line change 2121#include <linux/ptrace.h>
2222#include <linux/rtc.h>
2323#include <linux/spinlock.h>
24+ #include <linux/clockchips.h>
2425#include <linux/clocksource.h>
2526
2627extern spinlock_t rtc_lock ;
@@ -83,4 +84,8 @@ static inline void mips_clockevent_init(void)
8384}
8485#endif
8586
87+ extern void clocksource_set_clock (struct clocksource * cs , unsigned int clock );
88+ extern void clockevent_set_clock (struct clock_event_device * cd ,
89+ unsigned int clock );
90+
8691#endif /* _ASM_TIME_H */
You can’t perform that action at this time.
0 commit comments