summaryrefslogtreecommitdiff
path: root/arch/xtensa/platforms
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2016-09-20 11:11:08 -0700
committerMax Filippov <jcmvbkbc@gmail.com>2016-09-20 18:52:59 -0700
commit205ad548a7426fb6813760cd9917d3fc24122576 (patch)
treeafee669f50dad5b75f622cecc03074d12c9b8e5f /arch/xtensa/platforms
parent58c3e3ac7a1daf56523567507a096a3e4026596d (diff)
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 <jcmvbkbc@gmail.com>
Diffstat (limited to 'arch/xtensa/platforms')
-rw-r--r--arch/xtensa/platforms/xtfpga/setup.c39
1 files changed, 1 insertions, 38 deletions
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