aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@free-electrons.com>2015-03-13 06:54:37 -0400
committerNicolas Ferre <nicolas.ferre@atmel.com>2015-03-16 12:03:07 -0400
commit0afb46b248eff66e619ac00ac96d2e986844575e (patch)
treee93f507f747fc20e51e9ef5d6c86f22c4c5dbb86
parentadf2edfd6003c401ae52a360e0e67abc7deeb952 (diff)
clocksource: atmel-st: remove mach/hardware dependency
Remove the mach/hardware dependency to prepare the driver for multiplatform support. Also switch from setup_irq() to request_irq() Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
-rw-r--r--drivers/clocksource/timer-atmel-st.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/clocksource/timer-atmel-st.c b/drivers/clocksource/timer-atmel-st.c
index 674ef2519d6b..1692e17e096b 100644
--- a/drivers/clocksource/timer-atmel-st.c
+++ b/drivers/clocksource/timer-atmel-st.c
@@ -29,15 +29,12 @@
29#include <linux/of_irq.h> 29#include <linux/of_irq.h>
30#include <linux/regmap.h> 30#include <linux/regmap.h>
31 31
32#include <asm/mach/time.h>
33
34#include <mach/hardware.h>
35
36static unsigned long last_crtr; 32static unsigned long last_crtr;
37static u32 irqmask; 33static u32 irqmask;
38static struct clock_event_device clkevt; 34static struct clock_event_device clkevt;
39static struct regmap *regmap_st; 35static struct regmap *regmap_st;
40 36
37#define AT91_SLOW_CLOCK 32768
41#define RM9200_TIMER_LATCH ((AT91_SLOW_CLOCK + HZ/2) / HZ) 38#define RM9200_TIMER_LATCH ((AT91_SLOW_CLOCK + HZ/2) / HZ)
42 39
43/* 40/*
@@ -96,13 +93,6 @@ static irqreturn_t at91rm9200_timer_interrupt(int irq, void *dev_id)
96 return IRQ_NONE; 93 return IRQ_NONE;
97} 94}
98 95
99static struct irqaction at91rm9200_timer_irq = {
100 .name = "at91_tick",
101 .flags = IRQF_SHARED | IRQF_TIMER | IRQF_IRQPOLL,
102 .handler = at91rm9200_timer_interrupt,
103 .irq = NR_IRQS_LEGACY + AT91_ID_SYS,
104};
105
106static cycle_t read_clk32k(struct clocksource *cs) 96static cycle_t read_clk32k(struct clocksource *cs)
107{ 97{
108 return read_CRTR(); 98 return read_CRTR();
@@ -193,6 +183,7 @@ static struct clock_event_device clkevt = {
193static void __init atmel_st_timer_init(struct device_node *node) 183static void __init atmel_st_timer_init(struct device_node *node)
194{ 184{
195 unsigned int val; 185 unsigned int val;
186 int irq, ret;
196 187
197 regmap_st = syscon_node_to_regmap(node); 188 regmap_st = syscon_node_to_regmap(node);
198 if (IS_ERR(regmap_st)) 189 if (IS_ERR(regmap_st))
@@ -204,12 +195,16 @@ static void __init atmel_st_timer_init(struct device_node *node)
204 regmap_read(regmap_st, AT91_ST_SR, &val); 195 regmap_read(regmap_st, AT91_ST_SR, &val);
205 196
206 /* Get the interrupts property */ 197 /* Get the interrupts property */
207 at91rm9200_timer_irq.irq = irq_of_parse_and_map(node, 0); 198 irq = irq_of_parse_and_map(node, 0);
208 if (!at91rm9200_timer_irq.irq) 199 if (!irq)
209 panic(pr_fmt("Unable to get IRQ from DT\n")); 200 panic(pr_fmt("Unable to get IRQ from DT\n"));
210 201
211 /* Make IRQs happen for the system timer */ 202 /* Make IRQs happen for the system timer */
212 setup_irq(at91rm9200_timer_irq.irq, &at91rm9200_timer_irq); 203 ret = request_irq(irq, at91rm9200_timer_interrupt,
204 IRQF_SHARED | IRQF_TIMER | IRQF_IRQPOLL,
205 "at91_tick", regmap_st);
206 if (ret)
207 panic(pr_fmt("Unable to setup IRQ\n"));
213 208
214 /* The 32KiHz "Slow Clock" (tick every 30517.58 nanoseconds) is used 209 /* The 32KiHz "Slow Clock" (tick every 30517.58 nanoseconds) is used
215 * directly for the clocksource and all clockevents, after adjusting 210 * directly for the clocksource and all clockevents, after adjusting