summaryrefslogtreecommitdiffstats
path: root/arch/arm/include
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2019-03-12 20:31:46 -0700
committerSascha Hauer <s.hauer@pengutronix.de>2019-03-18 09:02:29 +0100
commit99ddaa5c52a3567f0ae928ce90c44e0976cf58ad (patch)
tree5cb2823bb05143289a6179fc9ef58b7c97591ab8 /arch/arm/include
parent5a0a6202956c8946ad9a8b93883466535a90607c (diff)
downloadbarebox-99ddaa5c52a3567f0ae928ce90c44e0976cf58ad.tar.gz
barebox-99ddaa5c52a3567f0ae928ce90c44e0976cf58ad.tar.xz
ARM: i.MX7: Make sure CNTFRQ is initialized early enough
We need to make sure that CNTFRQ is initialized before corresponding clocksource driver tries to use it, otherwise we'll end up crashing due to division by zero. We can't convert imx7_timer_init() to be an initcall since it is an i.MX7 specific task, but CPU type information won't be availible until after imx_init() gets executed at postcore_initcall() level. To solve this move all of the necessary code to be a part of imx7_cpu_lowlevel_init(). Note, that original code both hardcoded frequency value to 8MHz as well as tried to write it to the first element of the frequency mode table which appears to be read-only on i.MX7. So while we are at it, simplify the code by adding set_cntfrq() implementation for ARMv7 and copy the code we already using for i.MX8MQ. Fixes: dece70752 ("clocksource: Enable architected timer support for CPU_V7") Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/include')
-rw-r--r--arch/arm/include/asm/system.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index e55b19a13c..ef9cb98bf0 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -127,6 +127,11 @@ static inline unsigned long get_cntpct(void)
return cntpct;
}
#else
+static inline void set_cntfrq(unsigned long cntfrq)
+{
+ asm("mcr p15, 0, %0, c14, c0, 0" : : "r" (cntfrq));
+}
+
static inline unsigned int get_cntfrq(void)
{
unsigned int val;