From 205ad548a7426fb6813760cd9917d3fc24122576 Mon Sep 17 00:00:00 2001 From: Max Filippov Date: Tue, 20 Sep 2016 11:11:08 -0700 Subject: xtensa: rearrange CCOUNT calibration DT-enabled kernel should have a CPU node connected to a clock. This clock is the CCOUNT clock. Use old platform_calibrate_ccount call as a fallback when CPU node cannot be found or has no clock and in non-DT-enabled configurations. Drop no longer needed code that updates CPU clock-frequency property in the DT; drop DT-related code from the platform_calibrate_ccount too. Move of_clk_init to the top of time_init, so that clocks are initialized before CCOUNT calibration is attempted. Signed-off-by: Max Filippov --- arch/xtensa/platforms/xtfpga/setup.c | 39 +----------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) (limited to 'arch/xtensa/platforms') diff --git a/arch/xtensa/platforms/xtfpga/setup.c b/arch/xtensa/platforms/xtfpga/setup.c index 99a38a6febea..e236df450a7b 100644 --- a/arch/xtensa/platforms/xtfpga/setup.c +++ b/arch/xtensa/platforms/xtfpga/setup.c @@ -66,29 +66,6 @@ void __init platform_setup(char **cmdline) #ifdef CONFIG_OF -static void __init update_clock_frequency(struct device_node *node) -{ - struct property *newfreq; - u32 freq; - - if (!of_property_read_u32(node, "clock-frequency", &freq) && freq != 0) - return; - - newfreq = kzalloc(sizeof(*newfreq) + sizeof(u32), GFP_KERNEL); - if (!newfreq) - return; - newfreq->value = newfreq + 1; - newfreq->length = sizeof(freq); - newfreq->name = kstrdup("clock-frequency", GFP_KERNEL); - if (!newfreq->name) { - kfree(newfreq); - return; - } - - *(u32 *)newfreq->value = cpu_to_be32(*(u32 *)XTFPGA_CLKFRQ_VADDR); - of_update_property(node, newfreq); -} - static void __init xtfpga_clk_setup(struct device_node *np) { void __iomem *base = of_iomap(np, 0); @@ -172,21 +149,7 @@ void platform_heartbeat(void) void __init platform_calibrate_ccount(void) { - long clk_freq = 0; -#ifdef CONFIG_OF - struct device_node *cpu = - of_find_compatible_node(NULL, NULL, "cdns,xtensa-cpu"); - if (cpu) { - u32 freq; - update_clock_frequency(cpu); - if (!of_property_read_u32(cpu, "clock-frequency", &freq)) - clk_freq = freq; - } -#endif - if (!clk_freq) - clk_freq = *(long *)XTFPGA_CLKFRQ_VADDR; - - ccount_freq = clk_freq; + ccount_freq = *(long *)XTFPGA_CLKFRQ_VADDR; } #endif -- cgit v1.2.3