68 lines
2.4 KiB
Diff
68 lines
2.4 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
|
|
|
|
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>
|
|
|
|
---
|
|
arch/arm/mach-at91/at91rm9200_time.c | 2 ++
|
|
arch/arm/mach-at91/at91sam926x_time.c | 6 +++++-
|
|
2 files changed, 7 insertions(+), 1 deletion(-)
|
|
|
|
Index: linux-3.2/arch/arm/mach-at91/at91rm9200_time.c
|
|
===================================================================
|
|
--- linux-3.2.orig/arch/arm/mach-at91/at91rm9200_time.c
|
|
+++ linux-3.2/arch/arm/mach-at91/at91rm9200_time.c
|
|
@@ -114,6 +114,7 @@ clkevt32k_mode(enum clock_event_mode mod
|
|
last_crtr = read_CRTR();
|
|
switch (mode) {
|
|
case CLOCK_EVT_MODE_PERIODIC:
|
|
+ setup_irq(AT91_ID_SYS, &at91rm9200_timer_irq);
|
|
/* PIT for periodic irqs; fixed rate of 1/HZ */
|
|
irqmask = AT91_ST_PITS;
|
|
at91_sys_write(AT91_ST_PIMR, LATCH);
|
|
@@ -127,6 +128,7 @@ clkevt32k_mode(enum clock_event_mode mod
|
|
break;
|
|
case CLOCK_EVT_MODE_SHUTDOWN:
|
|
case CLOCK_EVT_MODE_UNUSED:
|
|
+ remove_irq(AT91_ID_SYS, &at91rm9200_timer_irq);
|
|
case CLOCK_EVT_MODE_RESUME:
|
|
irqmask = 0;
|
|
break;
|
|
Index: linux-3.2/arch/arm/mach-at91/at91sam926x_time.c
|
|
===================================================================
|
|
--- linux-3.2.orig/arch/arm/mach-at91/at91sam926x_time.c
|
|
+++ linux-3.2/arch/arm/mach-at91/at91sam926x_time.c
|
|
@@ -54,7 +54,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)
|
|
*/
|
|
@@ -63,6 +63,9 @@ pit_clkevt_mode(enum clock_event_mode mo
|
|
{
|
|
switch (mode) {
|
|
case CLOCK_EVT_MODE_PERIODIC:
|
|
+ /* Set up irq handler */
|
|
+ setup_irq(AT91_ID_SYS, &at91sam926x_pit_irq);
|
|
+
|
|
/* update clocksource counter */
|
|
pit_cnt += pit_cycle * PIT_PICNT(at91_sys_read(AT91_PIT_PIVR));
|
|
at91_sys_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN
|
|
@@ -75,6 +78,7 @@ pit_clkevt_mode(enum clock_event_mode mo
|
|
case CLOCK_EVT_MODE_UNUSED:
|
|
/* disable irq, leaving the clocksource active */
|
|
at91_sys_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN);
|
|
+ remove_irq(AT91_ID_SYS, &at91sam926x_pit_irq);
|
|
break;
|
|
case CLOCK_EVT_MODE_RESUME:
|
|
break;
|