• Mark Rutland's avatar
    arm: arch_timer: standardise counter reading · b8e24343
    Mark Rutland authored
    We're currently inconsistent with respect to our accesses to the
    physical and virtual counters, mixing and matching the two.
    
    This patch introduces and uses a function pointer for accessing the
    correct counter based on whether we're using physical or virtual
    interrupts. All current accesses to the counter accessors are redirected
    through it.
    
    When the driver is moved out to drivers/clocksource, there's the
    possibility that code called before the timer code is initialised will
    attempt to call arch_timer_read_counter (e.g. sched_clock for AArch64).
    To avoid having to have to check whether the timer has been initialised
    either in arch_timer_read_counter or one of it's callers, a default
    implementation is assigned that simply returns 0.
    Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
    Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
    Cc: Marc Zyngier <marc.zyngier@arm.com>
    Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
    b8e24343
arch_timer.c 11.9 KB