arch_timer.c (f48b5f12799dbabba4a9c799a9bef0775b2f977d) arch_timer.c (a1b2dde70419ae947fd7c9c8fcad7da005dc600e)
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

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

328int read_current_timer(unsigned long *timer_val)
329{
330 if (!arch_timer_rate)
331 return -ENXIO;
332 *timer_val = arch_counter_get_cntpct();
333 return 0;
334}
335
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

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

328int read_current_timer(unsigned long *timer_val)
329{
330 if (!arch_timer_rate)
331 return -ENXIO;
332 *timer_val = arch_counter_get_cntpct();
333 return 0;
334}
335
336static cycle_t arch_counter_read_cc(const struct cyclecounter *cc)
337{
338 /*
339 * Always use the physical counter for the clocksource.
340 * CNTHCTL.PL1PCTEN must be set to 1.
341 */
342 return arch_counter_get_cntpct();
343}
344
336static struct clocksource clocksource_counter = {
337 .name = "arch_sys_counter",
338 .rating = 400,
339 .read = arch_counter_read,
340 .mask = CLOCKSOURCE_MASK(56),
341 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
342};
343
345static struct clocksource clocksource_counter = {
346 .name = "arch_sys_counter",
347 .rating = 400,
348 .read = arch_counter_read,
349 .mask = CLOCKSOURCE_MASK(56),
350 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
351};
352
353static struct cyclecounter cyclecounter = {
354 .read = arch_counter_read_cc,
355 .mask = CLOCKSOURCE_MASK(56),
356};
357
358static struct timecounter timecounter;
359
360struct timecounter *arch_timer_get_timecounter(void)
361{
362 return &timecounter;
363}
364
344static void __cpuinit arch_timer_stop(struct clock_event_device *clk)
345{
346 pr_debug("arch_timer_teardown disable IRQ%d cpu #%d\n",
347 clk->irq, smp_processor_id());
348
349 if (arch_timer_use_virtual)
350 disable_percpu_irq(arch_timer_ppi[VIRT_PPI]);
351 else {

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

375
376 arch_timer_evt = alloc_percpu(struct clock_event_device *);
377 if (!arch_timer_evt) {
378 err = -ENOMEM;
379 goto out;
380 }
381
382 clocksource_register_hz(&clocksource_counter, arch_timer_rate);
365static void __cpuinit arch_timer_stop(struct clock_event_device *clk)
366{
367 pr_debug("arch_timer_teardown disable IRQ%d cpu #%d\n",
368 clk->irq, smp_processor_id());
369
370 if (arch_timer_use_virtual)
371 disable_percpu_irq(arch_timer_ppi[VIRT_PPI]);
372 else {

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

396
397 arch_timer_evt = alloc_percpu(struct clock_event_device *);
398 if (!arch_timer_evt) {
399 err = -ENOMEM;
400 goto out;
401 }
402
403 clocksource_register_hz(&clocksource_counter, arch_timer_rate);
404 cyclecounter.mult = clocksource_counter.mult;
405 cyclecounter.shift = clocksource_counter.shift;
406 timecounter_init(&timecounter, &cyclecounter,
407 arch_counter_get_cntpct());
383
384 if (arch_timer_use_virtual) {
385 ppi = arch_timer_ppi[VIRT_PPI];
386 err = request_percpu_irq(ppi, arch_timer_handler_virt,
387 "arch_timer", arch_timer_evt);
388 } else {
389 ppi = arch_timer_ppi[PHYS_SECURE_PPI];
390 err = request_percpu_irq(ppi, arch_timer_handler_phys,

--- 110 unchanged lines hidden ---
408
409 if (arch_timer_use_virtual) {
410 ppi = arch_timer_ppi[VIRT_PPI];
411 err = request_percpu_irq(ppi, arch_timer_handler_virt,
412 "arch_timer", arch_timer_evt);
413 } else {
414 ppi = arch_timer_ppi[PHYS_SECURE_PPI];
415 err = request_percpu_irq(ppi, arch_timer_handler_phys,

--- 110 unchanged lines hidden ---