diff options
Diffstat (limited to 'arch/mips/kernel/time.c')
-rw-r--r-- | arch/mips/kernel/time.c | 45 |
1 files changed, 14 insertions, 31 deletions
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c index 628a8ba6da57..9bbbd9b327fc 100644 --- a/arch/mips/kernel/time.c +++ b/arch/mips/kernel/time.c | |||
@@ -49,24 +49,19 @@ | |||
49 | * forward reference | 49 | * forward reference |
50 | */ | 50 | */ |
51 | DEFINE_SPINLOCK(rtc_lock); | 51 | DEFINE_SPINLOCK(rtc_lock); |
52 | EXPORT_SYMBOL(rtc_lock); | ||
52 | 53 | ||
53 | /* | 54 | int __weak rtc_mips_set_time(unsigned long sec) |
54 | * By default we provide the null RTC ops | ||
55 | */ | ||
56 | static unsigned long null_rtc_get_time(void) | ||
57 | { | 55 | { |
58 | return mktime(2000, 1, 1, 0, 0, 0); | 56 | return 0; |
59 | } | 57 | } |
58 | EXPORT_SYMBOL(rtc_mips_set_time); | ||
60 | 59 | ||
61 | static int null_rtc_set_time(unsigned long sec) | 60 | int __weak rtc_mips_set_mmss(unsigned long nowtime) |
62 | { | 61 | { |
63 | return 0; | 62 | return rtc_mips_set_time(nowtime); |
64 | } | 63 | } |
65 | 64 | ||
66 | unsigned long (*rtc_mips_get_time)(void) = null_rtc_get_time; | ||
67 | int (*rtc_mips_set_time)(unsigned long) = null_rtc_set_time; | ||
68 | int (*rtc_mips_set_mmss)(unsigned long); | ||
69 | |||
70 | int update_persistent_clock(struct timespec now) | 65 | int update_persistent_clock(struct timespec now) |
71 | { | 66 | { |
72 | return rtc_mips_set_mmss(now.tv_sec); | 67 | return rtc_mips_set_mmss(now.tv_sec); |
@@ -247,21 +242,18 @@ asmlinkage void ll_local_timer_interrupt(int irq) | |||
247 | /* | 242 | /* |
248 | * time_init() - it does the following things. | 243 | * time_init() - it does the following things. |
249 | * | 244 | * |
250 | * 1) board_time_init() - | 245 | * 1) plat_time_init() - |
251 | * a) (optional) set up RTC routines, | 246 | * a) (optional) set up RTC routines, |
252 | * b) (optional) calibrate and set the mips_hpt_frequency | 247 | * b) (optional) calibrate and set the mips_hpt_frequency |
253 | * (only needed if you intended to use cpu counter as timer interrupt | 248 | * (only needed if you intended to use cpu counter as timer interrupt |
254 | * source) | 249 | * source) |
255 | * 2) setup xtime based on rtc_mips_get_time(). | 250 | * 2) calculate a couple of cached variables for later usage |
256 | * 3) calculate a couple of cached variables for later usage | 251 | * 3) plat_timer_setup() - |
257 | * 4) plat_timer_setup() - | ||
258 | * a) (optional) over-write any choices made above by time_init(). | 252 | * a) (optional) over-write any choices made above by time_init(). |
259 | * b) machine specific code should setup the timer irqaction. | 253 | * b) machine specific code should setup the timer irqaction. |
260 | * c) enable the timer interrupt | 254 | * c) enable the timer interrupt |
261 | */ | 255 | */ |
262 | 256 | ||
263 | void (*board_time_init)(void); | ||
264 | |||
265 | unsigned int mips_hpt_frequency; | 257 | unsigned int mips_hpt_frequency; |
266 | 258 | ||
267 | static struct irqaction timer_irqaction = { | 259 | static struct irqaction timer_irqaction = { |
@@ -341,19 +333,13 @@ static void __init init_mips_clocksource(void) | |||
341 | clocksource_register(&clocksource_mips); | 333 | clocksource_register(&clocksource_mips); |
342 | } | 334 | } |
343 | 335 | ||
344 | void __init time_init(void) | 336 | void __init __weak plat_time_init(void) |
345 | { | 337 | { |
346 | if (board_time_init) | 338 | } |
347 | board_time_init(); | ||
348 | |||
349 | if (!rtc_mips_set_mmss) | ||
350 | rtc_mips_set_mmss = rtc_mips_set_time; | ||
351 | |||
352 | xtime.tv_sec = rtc_mips_get_time(); | ||
353 | xtime.tv_nsec = 0; | ||
354 | 339 | ||
355 | set_normalized_timespec(&wall_to_monotonic, | 340 | void __init time_init(void) |
356 | -xtime.tv_sec, -xtime.tv_nsec); | 341 | { |
342 | plat_time_init(); | ||
357 | 343 | ||
358 | /* Choose appropriate high precision timer routines. */ | 344 | /* Choose appropriate high precision timer routines. */ |
359 | if (!cpu_has_counter && !clocksource_mips.read) | 345 | if (!cpu_has_counter && !clocksource_mips.read) |
@@ -459,7 +445,4 @@ void to_tm(unsigned long tim, struct rtc_time *tm) | |||
459 | tm->tm_wday = (gday + 4) % 7; /* 1970/1/1 was Thursday */ | 445 | tm->tm_wday = (gday + 4) % 7; /* 1970/1/1 was Thursday */ |
460 | } | 446 | } |
461 | 447 | ||
462 | EXPORT_SYMBOL(rtc_lock); | ||
463 | EXPORT_SYMBOL(to_tm); | 448 | EXPORT_SYMBOL(to_tm); |
464 | EXPORT_SYMBOL(rtc_mips_set_time); | ||
465 | EXPORT_SYMBOL(rtc_mips_get_time); | ||