/* * linux/drivers/clocksource/arm_arch_timer.c * * Copyright (C) 2011 ARM Ltd. * All Rights Reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */#define pr_fmt(fmt) "arm_arch_timer: " fmt#include<linux/init.h>#include<linux/kernel.h>#include<linux/device.h>#include<linux/smp.h>#include<linux/cpu.h>#include<linux/cpu_pm.h>#include<linux/clockchips.h>#include<linux/clocksource.h>#include<linux/interrupt.h>#include<linux/of_irq.h>#include<linux/of_address.h>#include<linux/io.h>#include<linux/slab.h>#include<linux/sched/clock.h>#include<linux/sched_clock.h>#include<linux/acpi.h>#include<asm/arch_timer.h>#include<asm/virt.h>#include<clocksource/arm_arch_timer.h>#undef pr_fmt#define pr_fmt(fmt) "arch_timer: " fmt#define CNTTIDR 0x08#define CNTTIDR_VIRT(n) (BIT(1) << ((n) * 4))#define CNTACR(n) (0x40 + ((n) * 4))#define CNTACR_RPCT BIT(0)#define CNTACR_RVCT BIT(1)#define CNTACR_RFRQ BIT(2)#define CNTACR_RVOFF BIT(3)#define CNTACR_RWVT BIT(4)#define CNTACR_RWPT BIT(5)#define CNTVCT_LO 0x08#define CNTVCT_HI 0x0c#define CNTFRQ 0x10#define CNTP_TVAL 0x28#define CNTP_CTL 0x2c#define CNTV_TVAL 0x38#define CNTV_CTL 0x3cstaticunsignedarch_timers_present__initdata;staticvoid__iomem*arch_counter_base;structarch_timer{void__iomem*base;structclock_event_deviceevt;};#define to_arch_timer(e) container_of(e, struct arch_timer, evt)staticu32arch_timer_rate;staticintarch_timer_ppi[ARCH_TIMER_MAX_TIMER_PPI];staticstructclock_event_device__percpu*arch_timer_evt;staticenumarch_timer_ppi_nrarch_timer_uses_ppi=ARCH_TIMER_VIRT_PPI;staticboolarch_timer_c3stop;static