aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-footbridge
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2013-11-30 07:21:21 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2013-12-29 07:36:07 -0500
commit4808972a1cac08f8e8d65419ab56d27a9da3a922 (patch)
tree3d026b41bf42408ebd8205b976dc19f582e07a1e /arch/arm/mach-footbridge
parent6cefe92f2991c2bcd8f3a16faa9f4e3c91be48f2 (diff)
ARM: footbridge: add one-shot mode for DC21285 timer
Add a one-shot mode for the DC21285 timer. This allows us to use the NO_HZ modes on this platform. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-footbridge')
-rw-r--r--arch/arm/mach-footbridge/dc21285-timer.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/arch/arm/mach-footbridge/dc21285-timer.c b/arch/arm/mach-footbridge/dc21285-timer.c
index 785e4199f9cd..2babdbcaa691 100644
--- a/arch/arm/mach-footbridge/dc21285-timer.c
+++ b/arch/arm/mach-footbridge/dc21285-timer.c
@@ -47,6 +47,16 @@ static struct clocksource cksrc_dc21285 = {
47 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 47 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
48}; 48};
49 49
50static int ckevt_dc21285_set_next_event(unsigned long delta,
51 struct clock_event_device *c)
52{
53 *CSR_TIMER1_CLR = 0;
54 *CSR_TIMER1_LOAD = delta;
55 *CSR_TIMER1_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_DIV16;
56
57 return 0;
58}
59
50static void ckevt_dc21285_set_mode(enum clock_event_mode mode, 60static void ckevt_dc21285_set_mode(enum clock_event_mode mode,
51 struct clock_event_device *c) 61 struct clock_event_device *c)
52{ 62{
@@ -59,7 +69,9 @@ static void ckevt_dc21285_set_mode(enum clock_event_mode mode,
59 TIMER_CNTL_DIV16; 69 TIMER_CNTL_DIV16;
60 break; 70 break;
61 71
62 default: 72 case CLOCK_EVT_MODE_ONESHOT:
73 case CLOCK_EVT_MODE_UNUSED:
74 case CLOCK_EVT_MODE_SHUTDOWN:
63 *CSR_TIMER1_CNTL = 0; 75 *CSR_TIMER1_CNTL = 0;
64 break; 76 break;
65 } 77 }
@@ -67,9 +79,11 @@ static void ckevt_dc21285_set_mode(enum clock_event_mode mode,
67 79
68static struct clock_event_device ckevt_dc21285 = { 80static struct clock_event_device ckevt_dc21285 = {
69 .name = "dc21285_timer1", 81 .name = "dc21285_timer1",
70 .features = CLOCK_EVT_FEAT_PERIODIC, 82 .features = CLOCK_EVT_FEAT_PERIODIC |
83 CLOCK_EVT_FEAT_ONESHOT,
71 .rating = 200, 84 .rating = 200,
72 .irq = IRQ_TIMER1, 85 .irq = IRQ_TIMER1,
86 .set_next_event = ckevt_dc21285_set_next_event,
73 .set_mode = ckevt_dc21285_set_mode, 87 .set_mode = ckevt_dc21285_set_mode,
74}; 88};
75 89
@@ -79,6 +93,10 @@ static irqreturn_t timer1_interrupt(int irq, void *dev_id)
79 93
80 *CSR_TIMER1_CLR = 0; 94 *CSR_TIMER1_CLR = 0;
81 95
96 /* Stop the timer if in one-shot mode */
97 if (ce->mode == CLOCK_EVT_MODE_ONESHOT)
98 *CSR_TIMER1_CNTL = 0;
99
82 ce->event_handler(ce); 100 ce->event_handler(ce);
83 101
84 return IRQ_HANDLED; 102 return IRQ_HANDLED;