diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2013-11-11 15:06:11 -0500 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2013-12-20 05:41:34 -0500 |
commit | 980c51ab0774b7cd701eeb84056c148f84e152d8 (patch) | |
tree | 82347e3b0c08678fa05a71c17a0f07ffe1248c94 /drivers/clocksource | |
parent | ecfc5f2c00ea12fb6bc696d636b8c3a36ae057a9 (diff) |
clocksource: sirf/marco+prima2: drop usage of CLOCK_TICK_RATE
Since CSR SiRF was converted to multi platform in cf82e0e (ARM: sirf:
enable multiplatform support) the symbol CLOCK_TICK_RATE isn't the
platform specific definition any more, but a global dummy value. There
was no harm introduced in cf82e0e because the global value happens to
match the old platform specific one, still this dummy value isn't
intended to be used and will hopefully disappear soon, so introduce a
local #define and use that instead.
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'drivers/clocksource')
-rw-r--r-- | drivers/clocksource/timer-marco.c | 13 | ||||
-rw-r--r-- | drivers/clocksource/timer-prima2.c | 16 |
2 files changed, 17 insertions, 12 deletions
diff --git a/drivers/clocksource/timer-marco.c b/drivers/clocksource/timer-marco.c index 09a17d9a6594..b52e1c078b99 100644 --- a/drivers/clocksource/timer-marco.c +++ b/drivers/clocksource/timer-marco.c | |||
@@ -19,7 +19,8 @@ | |||
19 | #include <linux/of_irq.h> | 19 | #include <linux/of_irq.h> |
20 | #include <linux/of_address.h> | 20 | #include <linux/of_address.h> |
21 | #include <linux/sched_clock.h> | 21 | #include <linux/sched_clock.h> |
22 | #include <asm/mach/time.h> | 22 | |
23 | #define MARCO_CLOCK_FREQ 1000000 | ||
23 | 24 | ||
24 | #define SIRFSOC_TIMER_32COUNTER_0_CTRL 0x0000 | 25 | #define SIRFSOC_TIMER_32COUNTER_0_CTRL 0x0000 |
25 | #define SIRFSOC_TIMER_32COUNTER_1_CTRL 0x0004 | 26 | #define SIRFSOC_TIMER_32COUNTER_1_CTRL 0x0004 |
@@ -191,7 +192,7 @@ static int sirfsoc_local_timer_setup(struct clock_event_device *ce) | |||
191 | ce->rating = 200; | 192 | ce->rating = 200; |
192 | ce->set_mode = sirfsoc_timer_set_mode; | 193 | ce->set_mode = sirfsoc_timer_set_mode; |
193 | ce->set_next_event = sirfsoc_timer_set_next_event; | 194 | ce->set_next_event = sirfsoc_timer_set_next_event; |
194 | clockevents_calc_mult_shift(ce, CLOCK_TICK_RATE, 60); | 195 | clockevents_calc_mult_shift(ce, MARCO_CLOCK_FREQ, 60); |
195 | ce->max_delta_ns = clockevent_delta2ns(-2, ce); | 196 | ce->max_delta_ns = clockevent_delta2ns(-2, ce); |
196 | ce->min_delta_ns = clockevent_delta2ns(2, ce); | 197 | ce->min_delta_ns = clockevent_delta2ns(2, ce); |
197 | ce->cpumask = cpumask_of(cpu); | 198 | ce->cpumask = cpumask_of(cpu); |
@@ -263,11 +264,11 @@ static void __init sirfsoc_marco_timer_init(void) | |||
263 | BUG_ON(IS_ERR(clk)); | 264 | BUG_ON(IS_ERR(clk)); |
264 | rate = clk_get_rate(clk); | 265 | rate = clk_get_rate(clk); |
265 | 266 | ||
266 | BUG_ON(rate < CLOCK_TICK_RATE); | 267 | BUG_ON(rate < MARCO_CLOCK_FREQ); |
267 | BUG_ON(rate % CLOCK_TICK_RATE); | 268 | BUG_ON(rate % MARCO_CLOCK_FREQ); |
268 | 269 | ||
269 | /* Initialize the timer dividers */ | 270 | /* Initialize the timer dividers */ |
270 | timer_div = rate / CLOCK_TICK_RATE - 1; | 271 | timer_div = rate / MARCO_CLOCK_FREQ - 1; |
271 | writel_relaxed(timer_div << 16, sirfsoc_timer_base + SIRFSOC_TIMER_64COUNTER_CTRL); | 272 | writel_relaxed(timer_div << 16, sirfsoc_timer_base + SIRFSOC_TIMER_64COUNTER_CTRL); |
272 | writel_relaxed(timer_div << 16, sirfsoc_timer_base + SIRFSOC_TIMER_32COUNTER_0_CTRL); | 273 | writel_relaxed(timer_div << 16, sirfsoc_timer_base + SIRFSOC_TIMER_32COUNTER_0_CTRL); |
273 | writel_relaxed(timer_div << 16, sirfsoc_timer_base + SIRFSOC_TIMER_32COUNTER_1_CTRL); | 274 | writel_relaxed(timer_div << 16, sirfsoc_timer_base + SIRFSOC_TIMER_32COUNTER_1_CTRL); |
@@ -283,7 +284,7 @@ static void __init sirfsoc_marco_timer_init(void) | |||
283 | /* Clear all interrupts */ | 284 | /* Clear all interrupts */ |
284 | writel_relaxed(0xFFFF, sirfsoc_timer_base + SIRFSOC_TIMER_INTR_STATUS); | 285 | writel_relaxed(0xFFFF, sirfsoc_timer_base + SIRFSOC_TIMER_INTR_STATUS); |
285 | 286 | ||
286 | BUG_ON(clocksource_register_hz(&sirfsoc_clocksource, CLOCK_TICK_RATE)); | 287 | BUG_ON(clocksource_register_hz(&sirfsoc_clocksource, MARCO_CLOCK_FREQ)); |
287 | 288 | ||
288 | sirfsoc_clockevent_init(); | 289 | sirfsoc_clockevent_init(); |
289 | } | 290 | } |
diff --git a/drivers/clocksource/timer-prima2.c b/drivers/clocksource/timer-prima2.c index 8a492d34ff9f..1a6b2d6356d6 100644 --- a/drivers/clocksource/timer-prima2.c +++ b/drivers/clocksource/timer-prima2.c | |||
@@ -21,6 +21,8 @@ | |||
21 | #include <linux/sched_clock.h> | 21 | #include <linux/sched_clock.h> |
22 | #include <asm/mach/time.h> | 22 | #include <asm/mach/time.h> |
23 | 23 | ||
24 | #define PRIMA2_CLOCK_FREQ 1000000 | ||
25 | |||
24 | #define SIRFSOC_TIMER_COUNTER_LO 0x0000 | 26 | #define SIRFSOC_TIMER_COUNTER_LO 0x0000 |
25 | #define SIRFSOC_TIMER_COUNTER_HI 0x0004 | 27 | #define SIRFSOC_TIMER_COUNTER_HI 0x0004 |
26 | #define SIRFSOC_TIMER_MATCH_0 0x0008 | 28 | #define SIRFSOC_TIMER_MATCH_0 0x0008 |
@@ -173,7 +175,7 @@ static u64 notrace sirfsoc_read_sched_clock(void) | |||
173 | static void __init sirfsoc_clockevent_init(void) | 175 | static void __init sirfsoc_clockevent_init(void) |
174 | { | 176 | { |
175 | sirfsoc_clockevent.cpumask = cpumask_of(0); | 177 | sirfsoc_clockevent.cpumask = cpumask_of(0); |
176 | clockevents_config_and_register(&sirfsoc_clockevent, CLOCK_TICK_RATE, | 178 | clockevents_config_and_register(&sirfsoc_clockevent, PRIMA2_CLOCK_FREQ, |
177 | 2, -2); | 179 | 2, -2); |
178 | } | 180 | } |
179 | 181 | ||
@@ -190,8 +192,8 @@ static void __init sirfsoc_prima2_timer_init(struct device_node *np) | |||
190 | 192 | ||
191 | rate = clk_get_rate(clk); | 193 | rate = clk_get_rate(clk); |
192 | 194 | ||
193 | BUG_ON(rate < CLOCK_TICK_RATE); | 195 | BUG_ON(rate < PRIMA2_CLOCK_FREQ); |
194 | BUG_ON(rate % CLOCK_TICK_RATE); | 196 | BUG_ON(rate % PRIMA2_CLOCK_FREQ); |
195 | 197 | ||
196 | sirfsoc_timer_base = of_iomap(np, 0); | 198 | sirfsoc_timer_base = of_iomap(np, 0); |
197 | if (!sirfsoc_timer_base) | 199 | if (!sirfsoc_timer_base) |
@@ -199,14 +201,16 @@ static void __init sirfsoc_prima2_timer_init(struct device_node *np) | |||
199 | 201 | ||
200 | sirfsoc_timer_irq.irq = irq_of_parse_and_map(np, 0); | 202 | sirfsoc_timer_irq.irq = irq_of_parse_and_map(np, 0); |
201 | 203 | ||
202 | writel_relaxed(rate / CLOCK_TICK_RATE / 2 - 1, sirfsoc_timer_base + SIRFSOC_TIMER_DIV); | 204 | writel_relaxed(rate / PRIMA2_CLOCK_FREQ / 2 - 1, |
205 | sirfsoc_timer_base + SIRFSOC_TIMER_DIV); | ||
203 | writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_LO); | 206 | writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_LO); |
204 | writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_HI); | 207 | writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_HI); |
205 | writel_relaxed(BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_STATUS); | 208 | writel_relaxed(BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_STATUS); |
206 | 209 | ||
207 | BUG_ON(clocksource_register_hz(&sirfsoc_clocksource, CLOCK_TICK_RATE)); | 210 | BUG_ON(clocksource_register_hz(&sirfsoc_clocksource, |
211 | PRIMA2_CLOCK_FREQ)); | ||
208 | 212 | ||
209 | sched_clock_register(sirfsoc_read_sched_clock, 64, CLOCK_TICK_RATE); | 213 | sched_clock_register(sirfsoc_read_sched_clock, 64, PRIMA2_CLOCK_FREQ); |
210 | 214 | ||
211 | BUG_ON(setup_irq(sirfsoc_timer_irq.irq, &sirfsoc_timer_irq)); | 215 | BUG_ON(setup_irq(sirfsoc_timer_irq.irq, &sirfsoc_timer_irq)); |
212 | 216 | ||