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: Manuel Lauss <mano@roarinelk.homelinux.net>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
Manuel Lauss 2008-12-21 09:26:22 +01:00 коммит произвёл Ralf Baechle
Родитель 074cf65670
Коммит 779e7d41ad
5 изменённых файлов: 28 добавлений и 12 удалений

Просмотреть файл

@ -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
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);
/* /*
* 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 \
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
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)
#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 = {
.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;