ARM: S5PV310: Implement kernel timers using MCT
Subsystems (3)
PATCH v3 1/1 ARM: S5PV310: Implement kernel timers using MCT
From: Changhwan Youn <[email protected]>
The Multi-Core Timer(MCT) of S5PV310 is designed for implementing clock source timer and clock event timers. This patch implements 1 clock source timer with 64 bit free running counter of MCT and 2 clock event timers with two of 31-bit tick counters.
---
NOTE: This depends on following...
- ARM: S5PV310: Add SYSTIMER IO Address mapping for MCT
- ARM: S5PV310: Add irq definition for kernel global timer
Changes since v2:
- Addressed comments from Russell King Added mct_clock_event_device structure
- Removed suspend()/resume() which are not used now
Changes since v1:
- Addressed comments from Russell King (implemented global timer, used local timer and so on)
- Fixed small things
arch/arm/Kconfig | 2 +- arch/arm/mach-s5pv310/Kconfig | 5 + arch/arm/mach-s5pv310/Makefile | 9 +- arch/arm/mach-s5pv310/include/mach/regs-mct.h | 52 +++ arch/arm/mach-s5pv310/mct.c | 423 +++++++++++++++++++++++++ 5 files changed, 489 insertions(+), 2 deletions(-) create mode 100644 arch/arm/mach-s5pv310/include/mach/regs-mct.h create mode 100644 arch/arm/mach-s5pv310/mct.c
arch/arm/Kconfig +1 -1
@@ -1341,7 +1341,7 @@ config LOCAL_TIMERS bool "Use local timer interrupts" depends on SMP default y - select HAVE_ARM_TWD if !ARCH_MSM_SCORPIONMP + select HAVE_ARM_TWD if (!ARCH_MSM_SCORPIONMP && !S5PV310_MCT) help Enable support for local timers on SMP platforms, rather then the legacy IPI broadcast method. Local timers allows the system
arch/arm/mach-s5pv310/Kconfig +5 -0
@@ -15,6 +15,11 @@ config CPU_S5PV310 help Enable S5PV310 CPU support +config S5PV310_MCT + bool "Kernel timer support by MCT" + help + Use MCT (Multi Core Timer) as kernel timers + config S5PV310_DEV_PD bool help
arch/arm/mach-s5pv310/Makefile +8 -1
@@ -13,11 +13,18 @@ obj- := # Core support for S5PV310 system obj-$(CONFIG_CPU_S5PV310) += cpu.o init.o clock.o irq-combiner.o -obj-$(CONFIG_CPU_S5PV310) += setup-i2c0.o time.o gpiolib.o irq-eint.o dma.o +obj-$(CONFIG_CPU_S5PV310) += setup-i2c0.o gpiolib.o irq-eint.o dma.o obj-$(CONFIG_CPU_FREQ) += cpufreq.o obj-$(CONFIG_SMP) += platsmp.o headsmp.o + +ifeq ($(CONFIG_S5PV310_MCT),y) +obj-y += mct.o +else +obj-y += time.o obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o +endif + obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o # machine support
arch/arm/mach-s5pv310/include/mach/regs-mct.h new file +52 -0
52 lines not on this page · raw message
arch/arm/mach-s5pv310/mct.c new file +423 -0
423 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v3 1/1 ARM: S5PV310: Implement kernel timers using MCT
Quoted 1 line · Kukjin Kim
+irqreturn_t
s5pv310_mct_comp_isr(int irq, void *dev_id)
static?
Review
Quoted 2 lines
(quoted diff) +2
-0+{ + struct clock_event_device *evt;
struct clock_event_device *evt = dev_id;
arch/arm/mach-s5pv310/mct.c line 234
Quoted 13 lines
arch/arm/mach-s5pv310/mct.c new file +13
-0+ +s5pv310_mct_write (0x1 ,S5PV310_MCT_G_INT_CSTAT ); + + evt = &mct_comp_device; + evt->event_handler (evt); + +return IRQ_HANDLED ; +} + +static struct irqaction mct_comp_event_irq = { + .name ="mct_comp_irq" , + .flags =IRQF_TIMER |IRQF_IRQPOLL , + .handler = s5pv310_mct_comp_isr,
.dev_id = &mct_comp_device,
arch/arm/mach-s5pv310/mct.c line 357
Quoted 5 lines
arch/arm/mach-s5pv310/mct.c new file +5
-0+static void s5pv310_mct_tick_init (struct clock_event_device *evt) +{ +unsigned int cpu =smp_processor_id (); + + evt = &mct_tick[cpu].evt;
Why do you want to overwrite the already provided event device?
PATCH v3 1/1 ARM: S5PV310: Implement kernel timers using MCT
Quoted 4 lines · Russell King - ARM Linux
Quoted 1 line · Kukjin Kim
+irqreturn_t
s5pv310_mct_comp_isr(int irq, void *dev_id)
Oops, I missed your reply :(
Quoted 7 lines
static?
Review
Quoted 2 lines
(quoted diff) +2
-0+{ + struct clock_event_device *evt;struct clock_event_device *evt = dev_id;
Quoted 16 lines
arch/arm/mach-s5pv310/mct.c line 234
Quoted 13 lines
arch/arm/mach-s5pv310/mct.c new file +13
-0+ +s5pv310_mct_write (0x1 ,S5PV310_MCT_G_INT_CSTAT ); + + evt = &mct_comp_device; + evt->event_handler (evt); + +return IRQ_HANDLED ; +} + +static struct irqaction mct_comp_event_irq = { + .name ="mct_comp_irq" , + .flags =IRQF_TIMER |IRQF_IRQPOLL , + .handler = s5pv310_mct_comp_isr,.dev_id = &mct_comp_device,
Ok...will address comments from you :-)
Quoted 8 lines
arch/arm/mach-s5pv310/mct.c line 357
Quoted 6 lines
arch/arm/mach-s5pv310/mct.c new file +5
-0+static void s5pv310_mct_tick_init (struct clock_event_device *evt) +{ +unsigned int cpu =smp_processor_id (); + + evt = &mct_tick[cpu].evt;Why do you want to overwrite the already provided event device?
Hmm...couldn't use just 'already provided event device' because can't get 'mct_clock_event_device' structure like following.
+ struct mct_clock_event_device *mevt =
+ container_of(evt, struct mct_clock_event_device, evt);
Do you have any idea for it?
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.