diff options
author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2018-06-07 06:00:35 -0700 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-06-11 08:54:10 +0200 |
commit | 758b6304c598a574c4aba8fe7cd9b7a15719057c (patch) | |
tree | 47ac4252e41552b87bf557ba35f228a7b4c53035 /drivers | |
parent | 2073d937faf2116c466f55d7c8e32ea2c80a1a01 (diff) | |
download | barebox-758b6304c598a574c4aba8fe7cd9b7a15719057c.tar.gz barebox-758b6304c598a574c4aba8fe7cd9b7a15719057c.tar.xz |
clocksource: armv8-timer: Convert explicit assembly into helpers
Move inline assembly related to querying and counter value as well as
getting and setting counter frequency register into asm/system.h as
well as converting it inot helper functions. This is done to make the
code availible to other parts of the system.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/clocksource/armv8-timer.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/drivers/clocksource/armv8-timer.c b/drivers/clocksource/armv8-timer.c index 57b0b694c7..c5306dcd24 100644 --- a/drivers/clocksource/armv8-timer.c +++ b/drivers/clocksource/armv8-timer.c @@ -22,12 +22,7 @@ uint64_t armv8_clocksource_read(void) { - unsigned long cntpct; - - isb(); - asm volatile("mrs %0, cntpct_el0" : "=r" (cntpct)); - - return cntpct; + return get_cntpct(); } static struct clocksource cs = { @@ -38,11 +33,7 @@ static struct clocksource cs = { static int armv8_timer_probe(struct device_d *dev) { - unsigned long cntfrq; - - asm volatile("mrs %0, cntfrq_el0" : "=r" (cntfrq)); - - cs.mult = clocksource_hz2mult(cntfrq, cs.shift); + cs.mult = clocksource_hz2mult(get_cntfrq(), cs.shift); return init_clock(&cs); } |