Commit 779e7d41 authored by Manuel Lauss's avatar Manuel Lauss Committed by Ralf Baechle

MIPS: make cp0 counter clocksource/event usable as fallback.

The current mips clock build infrastructure lets a system only use
either the MIPS cp0 counter or a SoC specific timer as a clocksource /
clockevent device.

This patch renames the core cp0 counter clocksource / clockevent functions
from mips_* to r4k_* and updates the wrappers in asm-mips/time.h to
call these renamed functions instead.

Chips which can detect whether it is safe to use a chip-specific timer
can now fall back on the cp0 counter if necessary and possible
(e.g. Alchemy with a follow-on patch).

Existing behaviour is not changed in any way.
Signed-off-by: default avatarManuel Lauss <mano@roarinelk.homelinux.net>
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 074cf656
...@@ -721,7 +721,11 @@ config CEVT_DS1287 ...@@ -721,7 +721,11 @@ config CEVT_DS1287
config CEVT_GT641XX config CEVT_GT641XX
bool bool
config CEVT_R4K_LIB
bool
config CEVT_R4K config CEVT_R4K
select CEVT_R4K_LIB
bool bool
config CEVT_SB1250 config CEVT_SB1250
...@@ -736,7 +740,11 @@ config CSRC_BCM1480 ...@@ -736,7 +740,11 @@ config CSRC_BCM1480
config CSRC_IOASIC config CSRC_IOASIC
bool bool
config CSRC_R4K_LIB
bool
config CSRC_R4K config CSRC_R4K
select CSRC_R4K_LIB
bool bool
config CSRC_SB1250 config CSRC_SB1250
......
...@@ -50,27 +50,35 @@ extern int (*perf_irq)(void); ...@@ -50,27 +50,35 @@ extern int (*perf_irq)(void);
/* /*
* Initialize the calling CPU's compare interrupt as clockevent device * Initialize the calling CPU's compare interrupt as clockevent device
*/ */
#ifdef CONFIG_CEVT_R4K #ifdef CONFIG_CEVT_R4K_LIB
extern int mips_clockevent_init(void);
extern unsigned int __weak get_c0_compare_int(void); extern unsigned int __weak get_c0_compare_int(void);
#else extern int r4k_clockevent_init(void);
#endif
static inline int mips_clockevent_init(void) static inline int mips_clockevent_init(void)
{ {
#ifdef CONFIG_CEVT_R4K
return r4k_clockevent_init();
#else
return -ENXIO; return -ENXIO;
}
#endif #endif
}
/* /*
* Initialize the count register as a clocksource * Initialize the count register as a clocksource
*/ */
#ifdef CONFIG_CSRC_R4K #ifdef CONFIG_CSRC_R4K_LIB
extern int init_mips_clocksource(void); extern int init_r4k_clocksource(void);
#else #endif
static inline int init_mips_clocksource(void) static inline int init_mips_clocksource(void)
{ {
#ifdef CONFIG_CSRC_R4K
return init_r4k_clocksource();
#else
return 0; return 0;
}
#endif #endif
}
extern void clocksource_set_clock(struct clocksource *cs, unsigned int clock); extern void clocksource_set_clock(struct clocksource *cs, unsigned int clock);
extern void clockevent_set_clock(struct clock_event_device *cd, extern void clockevent_set_clock(struct clock_event_device *cd,
......
...@@ -9,7 +9,7 @@ obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \ ...@@ -9,7 +9,7 @@ obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \
time.o topology.o traps.o unaligned.o watch.o time.o topology.o traps.o unaligned.o watch.o
obj-$(CONFIG_CEVT_BCM1480) += cevt-bcm1480.o obj-$(CONFIG_CEVT_BCM1480) += cevt-bcm1480.o
obj-$(CONFIG_CEVT_R4K) += cevt-r4k.o obj-$(CONFIG_CEVT_R4K_LIB) += cevt-r4k.o
obj-$(CONFIG_MIPS_MT_SMTC) += cevt-smtc.o obj-$(CONFIG_MIPS_MT_SMTC) += cevt-smtc.o
obj-$(CONFIG_CEVT_DS1287) += cevt-ds1287.o obj-$(CONFIG_CEVT_DS1287) += cevt-ds1287.o
obj-$(CONFIG_CEVT_GT641XX) += cevt-gt641xx.o obj-$(CONFIG_CEVT_GT641XX) += cevt-gt641xx.o
...@@ -17,7 +17,7 @@ obj-$(CONFIG_CEVT_SB1250) += cevt-sb1250.o ...@@ -17,7 +17,7 @@ obj-$(CONFIG_CEVT_SB1250) += cevt-sb1250.o
obj-$(CONFIG_CEVT_TXX9) += cevt-txx9.o obj-$(CONFIG_CEVT_TXX9) += cevt-txx9.o
obj-$(CONFIG_CSRC_BCM1480) += csrc-bcm1480.o obj-$(CONFIG_CSRC_BCM1480) += csrc-bcm1480.o
obj-$(CONFIG_CSRC_IOASIC) += csrc-ioasic.o obj-$(CONFIG_CSRC_IOASIC) += csrc-ioasic.o
obj-$(CONFIG_CSRC_R4K) += csrc-r4k.o obj-$(CONFIG_CSRC_R4K_LIB) += csrc-r4k.o
obj-$(CONFIG_CSRC_SB1250) += csrc-sb1250.o obj-$(CONFIG_CSRC_SB1250) += csrc-sb1250.o
obj-$(CONFIG_SYNC_R4K) += sync-r4k.o obj-$(CONFIG_SYNC_R4K) += sync-r4k.o
......
...@@ -160,7 +160,7 @@ int c0_compare_int_usable(void) ...@@ -160,7 +160,7 @@ int c0_compare_int_usable(void)
#ifndef CONFIG_MIPS_MT_SMTC #ifndef CONFIG_MIPS_MT_SMTC
int __cpuinit mips_clockevent_init(void) int __cpuinit r4k_clockevent_init(void)
{ {
uint64_t mips_freq = mips_hpt_frequency; uint64_t mips_freq = mips_hpt_frequency;
unsigned int cpu = smp_processor_id(); unsigned int cpu = smp_processor_id();
......
...@@ -22,7 +22,7 @@ static struct clocksource clocksource_mips = { ...@@ -22,7 +22,7 @@ static struct clocksource clocksource_mips = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS, .flags = CLOCK_SOURCE_IS_CONTINUOUS,
}; };
int __init init_mips_clocksource(void) int __init init_r4k_clocksource(void)
{ {
if (!cpu_has_counter || !mips_hpt_frequency) if (!cpu_has_counter || !mips_hpt_frequency)
return -ENXIO; return -ENXIO;
......
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