aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clocksource/nomadik-mtu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/clocksource/nomadik-mtu.c')
-rw-r--r--drivers/clocksource/nomadik-mtu.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/drivers/clocksource/nomadik-mtu.c b/drivers/clocksource/nomadik-mtu.c
index 5f3c8dbf360f..435e54d55bbd 100644
--- a/drivers/clocksource/nomadik-mtu.c
+++ b/drivers/clocksource/nomadik-mtu.c
@@ -141,12 +141,32 @@ static void nmdk_clkevt_mode(enum clock_event_mode mode,
141 } 141 }
142} 142}
143 143
144void nmdk_clksrc_reset(void)
145{
146 /* Disable */
147 writel(0, mtu_base + MTU_CR(0));
148
149 /* ClockSource: configure load and background-load, and fire it up */
150 writel(nmdk_cycle, mtu_base + MTU_LR(0));
151 writel(nmdk_cycle, mtu_base + MTU_BGLR(0));
152
153 writel(clk_prescale | MTU_CRn_32BITS | MTU_CRn_ENA,
154 mtu_base + MTU_CR(0));
155}
156
157static void nmdk_clkevt_resume(struct clock_event_device *cedev)
158{
159 nmdk_clkevt_reset();
160 nmdk_clksrc_reset();
161}
162
144static struct clock_event_device nmdk_clkevt = { 163static struct clock_event_device nmdk_clkevt = {
145 .name = "mtu_1", 164 .name = "mtu_1",
146 .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC, 165 .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC,
147 .rating = 200, 166 .rating = 200,
148 .set_mode = nmdk_clkevt_mode, 167 .set_mode = nmdk_clkevt_mode,
149 .set_next_event = nmdk_clkevt_next, 168 .set_next_event = nmdk_clkevt_next,
169 .resume = nmdk_clkevt_resume,
150}; 170};
151 171
152/* 172/*
@@ -168,19 +188,6 @@ static struct irqaction nmdk_timer_irq = {
168 .dev_id = &nmdk_clkevt, 188 .dev_id = &nmdk_clkevt,
169}; 189};
170 190
171void nmdk_clksrc_reset(void)
172{
173 /* Disable */
174 writel(0, mtu_base + MTU_CR(0));
175
176 /* ClockSource: configure load and background-load, and fire it up */
177 writel(nmdk_cycle, mtu_base + MTU_LR(0));
178 writel(nmdk_cycle, mtu_base + MTU_BGLR(0));
179
180 writel(clk_prescale | MTU_CRn_32BITS | MTU_CRn_ENA,
181 mtu_base + MTU_CR(0));
182}
183
184void __init nmdk_timer_init(void __iomem *base, int irq) 191void __init nmdk_timer_init(void __iomem *base, int irq)
185{ 192{
186 unsigned long rate; 193 unsigned long rate;