@@ -28,6 +28,9 @@ extern void plat_time_init(void);
*/
extern unsigned int mips_hpt_frequency;
+/* True if platform registered sched_clock by itself */
+extern bool plat_have_sched_clock __initdata;
+
/*
* The performance counter IRQ on MIPS is a close relative to the timer IRQ
* so it lives here.
@@ -122,9 +122,8 @@ int __init init_r4k_clocksource(void)
clocksource_register_hz(&clocksource_mips, mips_hpt_frequency);
-#ifndef CONFIG_CPU_FREQ
- sched_clock_register(r4k_read_sched_clock, 32, mips_hpt_frequency);
-#endif
+ if (!IS_ENABLED(CONFIG_CPU_FREQ) && !plat_have_sched_clock)
+ sched_clock_register(r4k_read_sched_clock, 32, mips_hpt_frequency);
return 0;
}
@@ -123,6 +123,9 @@ EXPORT_SYMBOL(perf_irq);
unsigned int mips_hpt_frequency;
EXPORT_SYMBOL_GPL(mips_hpt_frequency);
+/* True if platform registered sched_clock by itself */
+bool plat_have_sched_clock __initdata;
+
static __init int cpu_has_mfc0_count_bug(void)
{
switch (current_cpu_type()) {