diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2019-03-08 15:49:13 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-03-11 10:27:44 +0100 |
commit | dece707522434d5c8eb35da8c98d0269112457f7 (patch) | |
tree | c54c782e428a70ad6e7b281873c96561ef3dd4e1 | |
parent | 6f9ff8615c1541941a04431c106fd4576a5d3976 (diff) | |
download | barebox-dece707522434d5c8eb35da8c98d0269112457f7.tar.gz barebox-dece707522434d5c8eb35da8c98d0269112457f7.tar.xz |
clocksource: Enable architected timer support for CPU_V7
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | arch/arm/include/asm/system.h | 19 | ||||
-rw-r--r-- | drivers/clocksource/Kconfig | 2 | ||||
-rw-r--r-- | drivers/clocksource/armv8-timer.c | 1 |
3 files changed, 21 insertions, 1 deletions
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h index 45eeb6e62c..e55b19a13c 100644 --- a/arch/arm/include/asm/system.h +++ b/arch/arm/include/asm/system.h @@ -126,6 +126,25 @@ static inline unsigned long get_cntpct(void) return cntpct; } +#else +static inline unsigned int get_cntfrq(void) +{ + unsigned int val; + + asm volatile("mrc p15, 0, %0, c14, c0, 0" : "=r" (val)); + + return val; +} + +static inline unsigned long long get_cntpct(void) +{ + unsigned long long cval; + + isb(); + asm volatile("mrrc p15, 0, %Q0, %R0, c14" : "=r" (cval)); + + return cval; +} #endif static inline unsigned int get_cr(void) diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index b0502c3036..43c5bfc973 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -73,7 +73,7 @@ config CLOCKSOURCE_ATMEL_PIT config CLOCKSOURCE_ARMV8_TIMER bool default y - depends on ARM && CPU_64v8 + depends on ARM && (CPU_64v8 || CPU_V7) config CLOCKSOURCE_ARM_GLOBAL_TIMER bool diff --git a/drivers/clocksource/armv8-timer.c b/drivers/clocksource/armv8-timer.c index 918232e0e0..3095f8cfc4 100644 --- a/drivers/clocksource/armv8-timer.c +++ b/drivers/clocksource/armv8-timer.c @@ -39,6 +39,7 @@ static int armv8_timer_probe(struct device_d *dev) } static struct of_device_id armv8_timer_dt_ids[] = { + { .compatible = "arm,armv7-timer", }, { .compatible = "arm,armv8-timer", }, { } }; |