arch_timer.c (273d16adbccdfe3e4a9d02d286b8f1d76dc9e63f) arch_timer.c (fb8a99f9f6bdc908cbbd2284cee80c709d9f7c03)
1/*
2 * linux/arch/arm/kernel/arch_timer.c
3 *
4 * Copyright (C) 2011 ARM Ltd.
5 * All Rights Reserved
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 234 unchanged lines hidden (view full) ---

243
244static struct local_timer_ops arch_timer_ops __cpuinitdata = {
245 .setup = arch_timer_setup,
246 .stop = arch_timer_stop,
247};
248
249static struct clock_event_device arch_timer_global_evt;
250
1/*
2 * linux/arch/arm/kernel/arch_timer.c
3 *
4 * Copyright (C) 2011 ARM Ltd.
5 * All Rights Reserved
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 234 unchanged lines hidden (view full) ---

243
244static struct local_timer_ops arch_timer_ops __cpuinitdata = {
245 .setup = arch_timer_setup,
246 .stop = arch_timer_stop,
247};
248
249static struct clock_event_device arch_timer_global_evt;
250
251static int __init arch_timer_common_register(void)
251static int __init arch_timer_register(void)
252{
253 int err;
254
255 err = arch_timer_available();
256 if (err)
257 return err;
258
259 arch_timer_evt = alloc_percpu(struct clock_event_device *);

--- 44 unchanged lines hidden (view full) ---

304 free_percpu_irq(arch_timer_ppi2, arch_timer_evt);
305
306out_free:
307 free_percpu(arch_timer_evt);
308
309 return err;
310}
311
252{
253 int err;
254
255 err = arch_timer_available();
256 if (err)
257 return err;
258
259 arch_timer_evt = alloc_percpu(struct clock_event_device *);

--- 44 unchanged lines hidden (view full) ---

304 free_percpu_irq(arch_timer_ppi2, arch_timer_evt);
305
306out_free:
307 free_percpu(arch_timer_evt);
308
309 return err;
310}
311
312int __init arch_timer_register(struct arch_timer *at)
313{
314 if (at->res[0].start <= 0 || !(at->res[0].flags & IORESOURCE_IRQ))
315 return -EINVAL;
316
317 arch_timer_ppi = at->res[0].start;
318
319 if (at->res[1].start > 0 || (at->res[1].flags & IORESOURCE_IRQ))
320 arch_timer_ppi2 = at->res[1].start;
321
322 return arch_timer_common_register();
323}
324
325#ifdef CONFIG_OF
326static const struct of_device_id arch_timer_of_match[] __initconst = {
327 { .compatible = "arm,armv7-timer", },
328 {},
329};
330
331int __init arch_timer_of_register(void)
332{
333 struct device_node *np;

--- 9 unchanged lines hidden (view full) ---

343 if (!of_property_read_u32(np, "clock-frequency", &freq))
344 arch_timer_rate = freq;
345
346 arch_timer_ppi = irq_of_parse_and_map(np, 0);
347 arch_timer_ppi2 = irq_of_parse_and_map(np, 1);
348 pr_info("arch_timer: found %s irqs %d %d\n",
349 np->name, arch_timer_ppi, arch_timer_ppi2);
350
312static const struct of_device_id arch_timer_of_match[] __initconst = {
313 { .compatible = "arm,armv7-timer", },
314 {},
315};
316
317int __init arch_timer_of_register(void)
318{
319 struct device_node *np;

--- 9 unchanged lines hidden (view full) ---

329 if (!of_property_read_u32(np, "clock-frequency", &freq))
330 arch_timer_rate = freq;
331
332 arch_timer_ppi = irq_of_parse_and_map(np, 0);
333 arch_timer_ppi2 = irq_of_parse_and_map(np, 1);
334 pr_info("arch_timer: found %s irqs %d %d\n",
335 np->name, arch_timer_ppi, arch_timer_ppi2);
336
351 return arch_timer_common_register();
337 return arch_timer_register();
352}
338}
353#endif
354
355int __init arch_timer_sched_clock_init(void)
356{
357 int err;
358
359 err = arch_timer_available();
360 if (err)
361 return err;
362
363 setup_sched_clock(arch_counter_get_cntvct32, 32, arch_timer_rate);
364 return 0;
365}
339
340int __init arch_timer_sched_clock_init(void)
341{
342 int err;
343
344 err = arch_timer_available();
345 if (err)
346 return err;
347
348 setup_sched_clock(arch_counter_get_cntvct32, 32, arch_timer_rate);
349 return 0;
350}