Linux 5.7.6
[linux/fpc-iii.git] / arch / mips / pistachio / time.c
blobde64751dec4019900c59dec5509391f198570e6d
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Pistachio clocksource/timer setup
5 * Copyright (C) 2014 Google, Inc.
6 */
8 #include <linux/clk.h>
9 #include <linux/clocksource.h>
10 #include <linux/init.h>
11 #include <linux/of.h>
12 #include <linux/of_clk.h>
14 #include <asm/mips-cps.h>
15 #include <asm/time.h>
17 unsigned int get_c0_compare_int(void)
19 return gic_get_c0_compare_int();
22 int get_c0_perfcount_int(void)
24 return gic_get_c0_perfcount_int();
26 EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
28 int get_c0_fdc_int(void)
30 return gic_get_c0_fdc_int();
33 void __init plat_time_init(void)
35 struct device_node *np;
36 struct clk *clk;
38 of_clk_init(NULL);
39 timer_probe();
41 np = of_get_cpu_node(0, NULL);
42 if (!np) {
43 pr_err("Failed to get CPU node\n");
44 return;
47 clk = of_clk_get(np, 0);
48 if (IS_ERR(clk)) {
49 pr_err("Failed to get CPU clock: %ld\n", PTR_ERR(clk));
50 return;
53 mips_hpt_frequency = clk_get_rate(clk) / 2;
54 clk_put(clk);