summaryrefslogtreecommitdiffstats
path: root/arch/arm/cpu/armv8/fsl-lsch3/cpu.c
diff options
context:
space:
mode:
authorYork Sun <yorksun@freescale.com>2015-03-20 19:28:08 -0700
committerYork Sun <yorksun@freescale.com>2015-04-23 08:55:55 -0700
commit207774b213caa3c72ebd6c9f6d1e4a3a666938b7 (patch)
treeb0249e1f667a1c607cc1409dfbe7db7fb9b62840 /arch/arm/cpu/armv8/fsl-lsch3/cpu.c
parent19f9175027b14f11b5a30df17ce76fb6f64dc724 (diff)
downloadtalos-obmc-uboot-207774b213caa3c72ebd6c9f6d1e4a3a666938b7.tar.gz
talos-obmc-uboot-207774b213caa3c72ebd6c9f6d1e4a3a666938b7.zip
armv8/ls2085a: Fix generic timer clock source
The timer clock is system clock divided by 4, not fixed 12MHz. This is common to the SoC, not board specific. Primary core is fixed when u-boot still runs in board_f. Secondary cores are fixed by reading a variable set by u-boot. Signed-off-by: York Sun <yorksun@freescale.com> CC: Mark Rutland <mark.rutland@arm.com>
Diffstat (limited to 'arch/arm/cpu/armv8/fsl-lsch3/cpu.c')
-rw-r--r--arch/arm/cpu/armv8/fsl-lsch3/cpu.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/arm/cpu/armv8/fsl-lsch3/cpu.c b/arch/arm/cpu/armv8/fsl-lsch3/cpu.c
index 94fd1474ed..e985181e8b 100644
--- a/arch/arm/cpu/armv8/fsl-lsch3/cpu.c
+++ b/arch/arm/cpu/armv8/fsl-lsch3/cpu.c
@@ -395,3 +395,27 @@ int arch_early_init_r(void)
return 0;
}
+
+int timer_init(void)
+{
+ u32 __iomem *cntcr = (u32 *)CONFIG_SYS_FSL_TIMER_ADDR;
+ u32 __iomem *cltbenr = (u32 *)CONFIG_SYS_FSL_PMU_CLTBENR;
+#ifdef COUNTER_FREQUENCY_REAL
+ unsigned long cntfrq = COUNTER_FREQUENCY_REAL;
+
+ /* Update with accurate clock frequency */
+ asm volatile("msr cntfrq_el0, %0" : : "r" (cntfrq) : "memory");
+#endif
+
+ /* Enable timebase for all clusters.
+ * It is safe to do so even some clusters are not enabled.
+ */
+ out_le32(cltbenr, 0xf);
+
+ /* Enable clock for timer
+ * This is a global setting.
+ */
+ out_le32(cntcr, 0x1);
+
+ return 0;
+}
OpenPOWER on IntegriCloud