]>
Commit | Line | Data |
---|---|---|
75a6faf6 | 1 | // SPDX-License-Identifier: GPL-2.0-only |
6a438309 AB |
2 | /* |
3 | * Pistachio clocksource/timer setup | |
4 | * | |
5 | * Copyright (C) 2014 Google, Inc. | |
6a438309 AB |
6 | */ |
7 | ||
8 | #include <linux/clk.h> | |
9 | #include <linux/clk-provider.h> | |
10 | #include <linux/clocksource.h> | |
11 | #include <linux/init.h> | |
6a438309 AB |
12 | #include <linux/of.h> |
13 | ||
dd016350 | 14 | #include <asm/mips-cps.h> |
6a438309 AB |
15 | #include <asm/time.h> |
16 | ||
17 | unsigned int get_c0_compare_int(void) | |
18 | { | |
19 | return gic_get_c0_compare_int(); | |
20 | } | |
21 | ||
22 | int get_c0_perfcount_int(void) | |
23 | { | |
24 | return gic_get_c0_perfcount_int(); | |
25 | } | |
0cb0985f | 26 | EXPORT_SYMBOL_GPL(get_c0_perfcount_int); |
6a438309 | 27 | |
6b5e741e JH |
28 | int get_c0_fdc_int(void) |
29 | { | |
30 | return gic_get_c0_fdc_int(); | |
31 | } | |
32 | ||
6a438309 AB |
33 | void __init plat_time_init(void) |
34 | { | |
35 | struct device_node *np; | |
36 | struct clk *clk; | |
37 | ||
38 | of_clk_init(NULL); | |
ba5d08c0 | 39 | timer_probe(); |
6a438309 AB |
40 | |
41 | np = of_get_cpu_node(0, NULL); | |
42 | if (!np) { | |
43 | pr_err("Failed to get CPU node\n"); | |
44 | return; | |
45 | } | |
46 | ||
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; | |
51 | } | |
52 | ||
53 | mips_hpt_frequency = clk_get_rate(clk) / 2; | |
54 | clk_put(clk); | |
55 | } |