CRISv32: use generic clockevents
PATCH 1/4 CRISv32: use generic clockevents
Implement a oneshot-capable clockevents device so we get support for things like hrtimers and NOHZ.
Signed-off-by Rabin Vincent <[email protected]>
--- arch/cris/Kconfig | 1 + arch/cris/arch-v32/kernel/time.c | 145 +++++++++++++++++++++++---------------- 2 files changed, 86 insertions(+), 60 deletions(-)
arch/cris/Kconfig +1 -0
@@ -55,6 +55,7 @@ config CRIS select IRQ_DOMAIN if ETRAX_ARCH_V32 select OF if ETRAX_ARCH_V32 select OF_EARLY_FLATTREE if ETRAX_ARCH_V32 + select GENERIC_CLOCKEVENTS if ETRAX_ARCH_V32 config HZ int
arch/cris/arch-v32/kernel/time.c +85 -60
195 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH 2/4 CRISv32: use MMIO clocksource
Use a generic MMIO clocksource and get rid of some lines of code.
Signed-off-by Rabin Vincent <[email protected]>
--- arch/cris/Kconfig | 1 + arch/cris/arch-v32/kernel/time.c | 25 ++++--------------------- 2 files changed, 5 insertions(+), 21 deletions(-)
arch/cris/Kconfig +1 -0
@@ -55,6 +55,7 @@ config CRIS select IRQ_DOMAIN if ETRAX_ARCH_V32 select OF if ETRAX_ARCH_V32 select OF_EARLY_FLATTREE if ETRAX_ARCH_V32 + select CLKSRC_MMIO if ETRAX_ARCH_V32 select GENERIC_CLOCKEVENTS if ETRAX_ARCH_V32 config HZ
arch/cris/arch-v32/kernel/time.c +4 -21
@@ -39,27 +39,6 @@#define CRISV32_TIMER_FREQ (100000000lu) -/* Register the continuos readonly timer available in FS and ARTPEC-3. */ -static cycle_t read_cont_rotime (struct clocksource *cs) -{ -return (u32 )REG_RD (timer, regi_timer0, r_time); -} - -static struct clocksource cont_rotime = { - .name ="crisv32_rotime" , - .rating =300 , - .read = read_cont_rotime, - .mask =CLOCKSOURCE_MASK (32 ), - .flags =CLOCK_SOURCE_IS_CONTINUOUS , -}; - -static int __init etrax_init_cont_rotime (void ) -{ -clocksource_register_khz (&cont_rotime,100000 ); -return 0 ; -} -arch_initcall (etrax_init_cont_rotime); -unsigned long timer_regs[NR_CPUS ] = { regi_timer0,
@@ -296,6 +275,10 @@ void __init time_init(void)crisv32_timer_init (); +clocksource_mmio_init (timer_base + REG_RD_ADDR_timer_r_time, +"crisv32-timer" ,CRISV32_TIMER_FREQ , +300 ,32 , clocksource_mmio_readl_up); + crisv32_clockevent.cpumask = cpu_possible_mask; crisv32_clockevent.irq = irq;
Signature · 1 line
2.1.4
PATCH 3/4 CRISv32: use GENERIC_SCHED_CLOCK
In reply to Rabin VincentProvide a fast sched clock using the free-running timer and the generic sched_clock infrastructure.
Signed-off-by Rabin Vincent <[email protected]>
--- arch/cris/Kconfig | 1 + arch/cris/arch-v32/kernel/time.c | 9 +++++++++ arch/cris/kernel/time.c | 2 ++ 3 files changed, 12 insertions(+)
arch/cris/Kconfig +1 -0
@@ -57,6 +57,7 @@ config CRIS select OF_EARLY_FLATTREE if ETRAX_ARCH_V32 select CLKSRC_MMIO if ETRAX_ARCH_V32 select GENERIC_CLOCKEVENTS if ETRAX_ARCH_V32 + select GENERIC_SCHED_CLOCK if ETRAX_ARCH_V32 config HZ int
arch/cris/arch-v32/kernel/time.c +9 -0
@@ -15,6 +15,7 @@#include <linux/init.h> #include <linux/threads.h> #include <linux/cpufreq.h> +#include <linux/sched_clock.h> #include <linux/mm.h> #include <asm/types.h> #include <asm/signal.h>
@@ -242,6 +243,11 @@ static struct irqaction irq_timer = { .dev_id = &crisv32_clockevent, }; +static u64 notrace crisv32_timer_sched_clock(void) +{ +return REG_RD (timer, timer_base, r_time); +} +static void __init crisv32_timer_init (void ) {reg_timer_rw_intr_mask timer_intr_mask;
@@ -275,6 +281,9 @@ void __init time_init(void)crisv32_timer_init (); +sched_clock_register (crisv32_timer_sched_clock,32 , +CRISV32_TIMER_FREQ ); +clocksource_mmio_init (timer_base + REG_RD_ADDR_timer_r_time,"crisv32-timer" ,CRISV32_TIMER_FREQ ,300 ,32 , clocksource_mmio_readl_up);
arch/cris/kernel/time.c +2 -0
@@ -79,11 +79,13 @@ cris_do_profile(struct pt_regs* regs)#endif } +#ifndef CONFIG_GENERIC_SCHED_CLOCK unsigned long long sched_clock (void ) {return (unsigned long long )jiffies * (NSEC_PER_SEC /HZ ) +get_ns_in_jiffie (); } +#endif static int __init init_udelay (void )
Signature · 1 line
2.1.4
PATCH 4/4 CRISv32: remove fast timer API
In reply to Rabin VincentThis fast timer API appears to provide an old pre-hrtimers implementation of sub-jiffy-resolution timers. No driver uses this API in mainline CRISv32 and we have support for hrtimers now, so remove it.
Signed-off-by Rabin Vincent <[email protected]>
--- arch/cris/Kconfig | 5 +- arch/cris/arch-v32/kernel/Makefile | 1 - arch/cris/arch-v32/kernel/fasttimer.c | 800 ---------------------------------- 3 files changed, 3 insertions(+), 803 deletions(-) delete mode 100644 arch/cris/arch-v32/kernel/fasttimer.c
arch/cris/Kconfig +3 -2
@@ -100,8 +100,9 @@ config ETRAX_WATCHDOG_NICE_DOGGY production releases. config ETRAX_FAST_TIMER - bool "Enable ETRAX fast timer API" - help + bool "Enable ETRAX fast timer API" + depends on ETRAX_ARCH_V10 + help This options enables the API to a fast timer implementation using timer1 to get sub jiffie resolution timers (primarily one-shot timers).
arch/cris/arch-v32/kernel/Makefile +0 -1
@@ -10,7 +10,6 @@ obj-y := entry.o traps.o irq.o debugport.o \ cache.o cacheflush.o obj-$(CONFIG_ETRAX_KGDB) += kgdb.o kgdb_asm.o -obj-$(CONFIG_ETRAX_FAST_TIMER) += fasttimer.o obj-$(CONFIG_MODULES) += crisksyms.o clean:
arch/cris/arch-v32/kernel/fasttimer.c deleted +0 -800
800 lines not on this page · raw message
Signature · 1 line
2.1.4