]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
ARM: tegra: clk_m is the architected timer source clock
authorThierry Reding <treding@nvidia.com>
Thu, 20 Aug 2015 09:42:20 +0000 (11:42 +0200)
committerTom Warren <twarren@nvidia.com>
Wed, 16 Sep 2015 23:10:22 +0000 (16:10 -0700)
While clk_m and the oscillator run at the same frequencies on Tegra114
and Tegra124, clk_m is the proper source for the architected timer. On
more recent Tegra generations, Tegra210 and later, both the oscillator
and clk_m can run at different frequencies. clk_m will be divided down
from the oscillator.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
arch/arm/mach-tegra/tegra114/clock.c
arch/arm/mach-tegra/tegra124/clock.c
arch/arm/mach-tegra/tegra210/clock.c

index 5e805a7baf032b5749df17601c377af653f42d8a..cec843b27df795898e37a3d5cb2979f9c9cf894c 100644 (file)
@@ -679,8 +679,8 @@ void arch_timer_init(void)
        struct sysctr_ctlr *sysctr = (struct sysctr_ctlr *)NV_PA_TSC_BASE;
        u32 freq, val;
 
-       freq = clock_get_rate(CLOCK_ID_OSC);
-       debug("%s: osc freq is %dHz [0x%08X]\n", __func__, freq, freq);
+       freq = clock_get_rate(CLOCK_ID_CLK_M);
+       debug("%s: clk_m freq is %dHz [0x%08X]\n", __func__, freq, freq);
 
        /* ARM CNTFRQ */
        asm("mcr p15, 0, %0, c14, c0, 0\n" : : "r" (freq));
index 61e8ab7053fd493f07e9a606ac74084fcf0d08ef..aa046e8950f7e9a16af42f6ba667c45543a69b41 100644 (file)
@@ -859,8 +859,8 @@ void arch_timer_init(void)
        struct sysctr_ctlr *sysctr = (struct sysctr_ctlr *)NV_PA_TSC_BASE;
        u32 freq, val;
 
-       freq = clock_get_rate(CLOCK_ID_OSC);
-       debug("%s: osc freq is %dHz [0x%08X]\n", __func__, freq, freq);
+       freq = clock_get_rate(CLOCK_ID_CLK_M);
+       debug("%s: clk_m freq is %dHz [0x%08X]\n", __func__, freq, freq);
 
        /* ARM CNTFRQ */
        asm("mcr p15, 0, %0, c14, c0, 0\n" : : "r" (freq));
index 146bb6453a19c5b4a135aa8fab4b1b4582356e56..6d75d371cb03cb6290cad1d971b41ca8d2d2c7e5 100644 (file)
@@ -1014,13 +1014,11 @@ void arch_timer_init(void)
        struct sysctr_ctlr *sysctr = (struct sysctr_ctlr *)NV_PA_TSC_BASE;
        u32 freq, val;
 
-       freq = clock_get_rate(CLOCK_ID_OSC);
-       debug("%s: osc freq is %dHz [0x%08X]\n", __func__, freq, freq);
+       freq = clock_get_rate(CLOCK_ID_CLK_M);
+       debug("%s: clk_m freq is %dHz [0x%08X]\n", __func__, freq, freq);
 
-       /* ARM CNTFRQ */
-#ifndef CONFIG_ARM64
-       asm("mcr p15, 0, %0, c14, c0, 0\n" : : "r" (freq));
-#endif
+       if (current_el() == 3)
+               asm("msr cntfrq_el0, %0\n" : : "r" (freq));
 
        /* Only Tegra114+ has the System Counter regs */
        debug("%s: setting CNTFID0 to 0x%08X\n", __func__, freq);