Commit 69e634f1 authored by Ralf Baechle's avatar Ralf Baechle

[MIPS] Clocksource: Only install r4k counter as clocksource if present.

Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 127f1668
...@@ -22,12 +22,17 @@ static struct clocksource clocksource_mips = { ...@@ -22,12 +22,17 @@ static struct clocksource clocksource_mips = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS, .flags = CLOCK_SOURCE_IS_CONTINUOUS,
}; };
void __init init_mips_clocksource(void) int __init init_mips_clocksource(void)
{ {
if (!cpu_has_counter || !mips_hpt_frequency)
return -ENXIO;
/* Calclate a somewhat reasonable rating value */ /* Calclate a somewhat reasonable rating value */
clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000; clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000;
clocksource_set_clock(&clocksource_mips, mips_hpt_frequency); clocksource_set_clock(&clocksource_mips, mips_hpt_frequency);
clocksource_register(&clocksource_mips); clocksource_register(&clocksource_mips);
return 0;
} }
...@@ -64,10 +64,11 @@ static inline int mips_clockevent_init(void) ...@@ -64,10 +64,11 @@ static inline int mips_clockevent_init(void)
* Initialize the count register as a clocksource * Initialize the count register as a clocksource
*/ */
#ifdef CONFIG_CEVT_R4K #ifdef CONFIG_CEVT_R4K
extern void init_mips_clocksource(void); extern int init_mips_clocksource(void);
#else #else
static inline void init_mips_clocksource(void) static inline int init_mips_clocksource(void)
{ {
return 0;
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment