~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to roms/u-boot/arch/arm/cpu/armv8/generic_timer.c

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * (C) Copyright 2013
 
3
 * David Feng <fenghua@phytium.com.cn>
 
4
 *
 
5
 * SPDX-License-Identifier:     GPL-2.0+
 
6
 */
 
7
 
 
8
#include <common.h>
 
9
#include <command.h>
 
10
#include <asm/system.h>
 
11
 
 
12
/*
 
13
 * Generic timer implementation of get_tbclk()
 
14
 */
 
15
unsigned long get_tbclk(void)
 
16
{
 
17
        unsigned long cntfrq;
 
18
        asm volatile("mrs %0, cntfrq_el0" : "=r" (cntfrq));
 
19
        return cntfrq;
 
20
}
 
21
 
 
22
/*
 
23
 * Generic timer implementation of timer_read_counter()
 
24
 */
 
25
unsigned long timer_read_counter(void)
 
26
{
 
27
        unsigned long cntpct;
 
28
        isb();
 
29
        asm volatile("mrs %0, cntpct_el0" : "=r" (cntpct));
 
30
        return cntpct;
 
31
}