diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-10 11:18:32 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-10 11:18:32 -0500 |
commit | a157508c9790ccd1c8b5c6a828d6ba85bbe95aaa (patch) | |
tree | 84fc815aac23bb44747e5bdad0559e7383d6f1e6 /drivers/clocksource | |
parent | 86c6a2fddf0b89b494c7616f2c06cf915c4bff01 (diff) | |
parent | 89de77a8c557f14d2713a1f43fbc33980e639b98 (diff) |
Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer core updates from Thomas Gleixner:
"The time(r) departement provides:
- more infrastructure work on the year 2038 issue
- a few fixes in the Armada SoC timers
- the usual pile of fixlets and improvements"
* 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
clocksource: armada-370-xp: Use the reference clock on A375 SoC
watchdog: orion: Use the reference clock on Armada 375 SoC
clocksource: armada-370-xp: Add missing clock enable
time: Fix sign bug in NTP mult overflow warning
time: Remove timekeeping_inject_sleeptime()
rtc: Update suspend/resume timing to use 64bit time
rtc/lib: Provide y2038 safe rtc_tm_to_time()/rtc_time_to_tm() replacement
time: Fixup comments to reflect usage of timespec64
time: Expose get_monotonic_coarse64() for in-kernel uses
time: Expose getrawmonotonic64 for in-kernel uses
time: Provide y2038 safe mktime() replacement
time: Provide y2038 safe timekeeping_inject_sleeptime() replacement
time: Provide y2038 safe do_settimeofday() replacement
time: Complete NTP adjustment threshold judging conditions
time: Avoid possible NTP adjustment mult overflow.
time: Rename udelay_test.c to test_udelay.c
clocksource: sirf: Remove hard-coded clock rate
Diffstat (limited to 'drivers/clocksource')
-rw-r--r-- | drivers/clocksource/time-armada-370-xp.c | 30 | ||||
-rw-r--r-- | drivers/clocksource/timer-marco.c | 23 |
2 files changed, 39 insertions, 14 deletions
diff --git a/drivers/clocksource/time-armada-370-xp.c b/drivers/clocksource/time-armada-370-xp.c index ff37d3abb806..0c8c5e337540 100644 --- a/drivers/clocksource/time-armada-370-xp.c +++ b/drivers/clocksource/time-armada-370-xp.c | |||
@@ -318,6 +318,7 @@ static void __init armada_xp_timer_init(struct device_node *np) | |||
318 | 318 | ||
319 | /* The 25Mhz fixed clock is mandatory, and must always be available */ | 319 | /* The 25Mhz fixed clock is mandatory, and must always be available */ |
320 | BUG_ON(IS_ERR(clk)); | 320 | BUG_ON(IS_ERR(clk)); |
321 | clk_prepare_enable(clk); | ||
321 | timer_clk = clk_get_rate(clk); | 322 | timer_clk = clk_get_rate(clk); |
322 | 323 | ||
323 | armada_370_xp_timer_common_init(np); | 324 | armada_370_xp_timer_common_init(np); |
@@ -325,11 +326,40 @@ static void __init armada_xp_timer_init(struct device_node *np) | |||
325 | CLOCKSOURCE_OF_DECLARE(armada_xp, "marvell,armada-xp-timer", | 326 | CLOCKSOURCE_OF_DECLARE(armada_xp, "marvell,armada-xp-timer", |
326 | armada_xp_timer_init); | 327 | armada_xp_timer_init); |
327 | 328 | ||
329 | static void __init armada_375_timer_init(struct device_node *np) | ||
330 | { | ||
331 | struct clk *clk; | ||
332 | |||
333 | clk = of_clk_get_by_name(np, "fixed"); | ||
334 | if (!IS_ERR(clk)) { | ||
335 | clk_prepare_enable(clk); | ||
336 | timer_clk = clk_get_rate(clk); | ||
337 | } else { | ||
338 | |||
339 | /* | ||
340 | * This fallback is required in order to retain proper | ||
341 | * devicetree backwards compatibility. | ||
342 | */ | ||
343 | clk = of_clk_get(np, 0); | ||
344 | |||
345 | /* Must have at least a clock */ | ||
346 | BUG_ON(IS_ERR(clk)); | ||
347 | clk_prepare_enable(clk); | ||
348 | timer_clk = clk_get_rate(clk) / TIMER_DIVIDER; | ||
349 | timer25Mhz = false; | ||
350 | } | ||
351 | |||
352 | armada_370_xp_timer_common_init(np); | ||
353 | } | ||
354 | CLOCKSOURCE_OF_DECLARE(armada_375, "marvell,armada-375-timer", | ||
355 | armada_375_timer_init); | ||
356 | |||
328 | static void __init armada_370_timer_init(struct device_node *np) | 357 | static void __init armada_370_timer_init(struct device_node *np) |
329 | { | 358 | { |
330 | struct clk *clk = of_clk_get(np, 0); | 359 | struct clk *clk = of_clk_get(np, 0); |
331 | 360 | ||
332 | BUG_ON(IS_ERR(clk)); | 361 | BUG_ON(IS_ERR(clk)); |
362 | clk_prepare_enable(clk); | ||
333 | timer_clk = clk_get_rate(clk) / TIMER_DIVIDER; | 363 | timer_clk = clk_get_rate(clk) / TIMER_DIVIDER; |
334 | timer25Mhz = false; | 364 | timer25Mhz = false; |
335 | 365 | ||
diff --git a/drivers/clocksource/timer-marco.c b/drivers/clocksource/timer-marco.c index caf7a2030461..361a789d4bee 100644 --- a/drivers/clocksource/timer-marco.c +++ b/drivers/clocksource/timer-marco.c | |||
@@ -20,8 +20,6 @@ | |||
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 | 22 | ||
23 | #define MARCO_CLOCK_FREQ 1000000 | ||
24 | |||
25 | #define SIRFSOC_TIMER_32COUNTER_0_CTRL 0x0000 | 23 | #define SIRFSOC_TIMER_32COUNTER_0_CTRL 0x0000 |
26 | #define SIRFSOC_TIMER_32COUNTER_1_CTRL 0x0004 | 24 | #define SIRFSOC_TIMER_32COUNTER_1_CTRL 0x0004 |
27 | #define SIRFSOC_TIMER_MATCH_0 0x0018 | 25 | #define SIRFSOC_TIMER_MATCH_0 0x0018 |
@@ -40,6 +38,8 @@ | |||
40 | 38 | ||
41 | #define SIRFSOC_TIMER_REG_CNT 6 | 39 | #define SIRFSOC_TIMER_REG_CNT 6 |
42 | 40 | ||
41 | static unsigned long marco_timer_rate; | ||
42 | |||
43 | static const u32 sirfsoc_timer_reg_list[SIRFSOC_TIMER_REG_CNT] = { | 43 | static const u32 sirfsoc_timer_reg_list[SIRFSOC_TIMER_REG_CNT] = { |
44 | SIRFSOC_TIMER_WATCHDOG_EN, | 44 | SIRFSOC_TIMER_WATCHDOG_EN, |
45 | SIRFSOC_TIMER_32COUNTER_0_CTRL, | 45 | SIRFSOC_TIMER_32COUNTER_0_CTRL, |
@@ -195,7 +195,7 @@ static int sirfsoc_local_timer_setup(struct clock_event_device *ce) | |||
195 | ce->rating = 200; | 195 | ce->rating = 200; |
196 | ce->set_mode = sirfsoc_timer_set_mode; | 196 | ce->set_mode = sirfsoc_timer_set_mode; |
197 | ce->set_next_event = sirfsoc_timer_set_next_event; | 197 | ce->set_next_event = sirfsoc_timer_set_next_event; |
198 | clockevents_calc_mult_shift(ce, MARCO_CLOCK_FREQ, 60); | 198 | clockevents_calc_mult_shift(ce, marco_timer_rate, 60); |
199 | ce->max_delta_ns = clockevent_delta2ns(-2, ce); | 199 | ce->max_delta_ns = clockevent_delta2ns(-2, ce); |
200 | ce->min_delta_ns = clockevent_delta2ns(2, ce); | 200 | ce->min_delta_ns = clockevent_delta2ns(2, ce); |
201 | ce->cpumask = cpumask_of(cpu); | 201 | ce->cpumask = cpumask_of(cpu); |
@@ -257,7 +257,6 @@ static void __init sirfsoc_clockevent_init(void) | |||
257 | /* initialize the kernel jiffy timer source */ | 257 | /* initialize the kernel jiffy timer source */ |
258 | static void __init sirfsoc_marco_timer_init(struct device_node *np) | 258 | static void __init sirfsoc_marco_timer_init(struct device_node *np) |
259 | { | 259 | { |
260 | unsigned long rate; | ||
261 | u32 timer_div; | 260 | u32 timer_div; |
262 | struct clk *clk; | 261 | struct clk *clk; |
263 | 262 | ||
@@ -266,16 +265,12 @@ static void __init sirfsoc_marco_timer_init(struct device_node *np) | |||
266 | 265 | ||
267 | BUG_ON(clk_prepare_enable(clk)); | 266 | BUG_ON(clk_prepare_enable(clk)); |
268 | 267 | ||
269 | rate = clk_get_rate(clk); | 268 | marco_timer_rate = clk_get_rate(clk); |
270 | |||
271 | BUG_ON(rate < MARCO_CLOCK_FREQ); | ||
272 | BUG_ON(rate % MARCO_CLOCK_FREQ); | ||
273 | 269 | ||
274 | /* Initialize the timer dividers */ | 270 | /* timer dividers: 0, not divided */ |
275 | timer_div = rate / MARCO_CLOCK_FREQ - 1; | 271 | writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_64COUNTER_CTRL); |
276 | writel_relaxed(timer_div << 16, sirfsoc_timer_base + SIRFSOC_TIMER_64COUNTER_CTRL); | 272 | writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_32COUNTER_0_CTRL); |
277 | writel_relaxed(timer_div << 16, sirfsoc_timer_base + SIRFSOC_TIMER_32COUNTER_0_CTRL); | 273 | writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_32COUNTER_1_CTRL); |
278 | writel_relaxed(timer_div << 16, sirfsoc_timer_base + SIRFSOC_TIMER_32COUNTER_1_CTRL); | ||
279 | 274 | ||
280 | /* Initialize timer counters to 0 */ | 275 | /* Initialize timer counters to 0 */ |
281 | writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_64COUNTER_LOAD_LO); | 276 | writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_64COUNTER_LOAD_LO); |
@@ -288,7 +283,7 @@ static void __init sirfsoc_marco_timer_init(struct device_node *np) | |||
288 | /* Clear all interrupts */ | 283 | /* Clear all interrupts */ |
289 | writel_relaxed(0xFFFF, sirfsoc_timer_base + SIRFSOC_TIMER_INTR_STATUS); | 284 | writel_relaxed(0xFFFF, sirfsoc_timer_base + SIRFSOC_TIMER_INTR_STATUS); |
290 | 285 | ||
291 | BUG_ON(clocksource_register_hz(&sirfsoc_clocksource, MARCO_CLOCK_FREQ)); | 286 | BUG_ON(clocksource_register_hz(&sirfsoc_clocksource, marco_timer_rate)); |
292 | 287 | ||
293 | sirfsoc_clockevent_init(); | 288 | sirfsoc_clockevent_init(); |
294 | } | 289 | } |