59 lines
2.3 KiB
Diff
59 lines
2.3 KiB
Diff
From: Benedikt Spranger <b.spranger@linutronix.de>
|
|
Date: Sat, 6 Mar 2010 17:47:10 +0100
|
|
Subject: ARM: AT91: PIT: Remove irq handler when clock event is unused
|
|
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/3.14/patches-3.14.3-rt5.tar.xz
|
|
|
|
Setup and remove the interrupt handler in clock event mode selection.
|
|
This avoids calling the (shared) interrupt handler when the device is
|
|
not used.
|
|
|
|
Signed-off-by: Benedikt Spranger <b.spranger@linutronix.de>
|
|
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
|
[bigeasy: redo the patch with NR_IRQS_LEGACY which is probably required since
|
|
commit 8fe82a55 ("ARM: at91: sparse irq support") which is included since v3.6.
|
|
Patch based on what Sami Pietikäinen <Sami.Pietikainen@wapice.com> suggested].
|
|
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|
---
|
|
arch/arm/mach-at91/at91rm9200_time.c | 1 +
|
|
arch/arm/mach-at91/at91sam926x_time.c | 5 ++++-
|
|
2 files changed, 5 insertions(+), 1 deletion(-)
|
|
|
|
--- a/arch/arm/mach-at91/at91rm9200_time.c
|
|
+++ b/arch/arm/mach-at91/at91rm9200_time.c
|
|
@@ -134,6 +134,7 @@ clkevt32k_mode(enum clock_event_mode mod
|
|
break;
|
|
case CLOCK_EVT_MODE_SHUTDOWN:
|
|
case CLOCK_EVT_MODE_UNUSED:
|
|
+ remove_irq(NR_IRQS_LEGACY + AT91_ID_SYS, &at91rm9200_timer_irq);
|
|
case CLOCK_EVT_MODE_RESUME:
|
|
irqmask = 0;
|
|
break;
|
|
--- a/arch/arm/mach-at91/at91sam926x_time.c
|
|
+++ b/arch/arm/mach-at91/at91sam926x_time.c
|
|
@@ -78,7 +78,7 @@ static struct clocksource pit_clk = {
|
|
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
|
|
};
|
|
|
|
-
|
|
+static struct irqaction at91sam926x_pit_irq;
|
|
/*
|
|
* Clockevent device: interrupts every 1/HZ (== pit_cycles * MCK/16)
|
|
*/
|
|
@@ -87,6 +87,8 @@ pit_clkevt_mode(enum clock_event_mode mo
|
|
{
|
|
switch (mode) {
|
|
case CLOCK_EVT_MODE_PERIODIC:
|
|
+ /* Set up irq handler */
|
|
+ setup_irq(at91sam926x_pit_irq.irq, &at91sam926x_pit_irq);
|
|
/* update clocksource counter */
|
|
pit_cnt += pit_cycle * PIT_PICNT(pit_read(AT91_PIT_PIVR));
|
|
pit_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN
|
|
@@ -99,6 +101,7 @@ pit_clkevt_mode(enum clock_event_mode mo
|
|
case CLOCK_EVT_MODE_UNUSED:
|
|
/* disable irq, leaving the clocksource active */
|
|
pit_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN);
|
|
+ remove_irq(at91sam926x_pit_irq.irq, &at91sam926x_pit_irq);
|
|
break;
|
|
case CLOCK_EVT_MODE_RESUME:
|
|
break;
|