diff options
author | 2025-03-08 22:04:20 +0800 | |
---|---|---|
committer | 2025-03-08 22:04:20 +0800 | |
commit | a07bb8fd1299070229f0e8f3dcb57ffd5ef9870a (patch) | |
tree | 84f21bd0bf7071bc5fc7dd989e77d7ceb5476682 /arch/mips/pistachio/time.c | |
download | ohosKernel-a07bb8fd1299070229f0e8f3dcb57ffd5ef9870a.tar.gz ohosKernel-a07bb8fd1299070229f0e8f3dcb57ffd5ef9870a.zip |
Initial commit: OpenHarmony-v4.0-ReleaseOpenHarmony-v4.0-Release
Diffstat (limited to 'arch/mips/pistachio/time.c')
-rw-r--r-- | arch/mips/pistachio/time.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/arch/mips/pistachio/time.c b/arch/mips/pistachio/time.c new file mode 100644 index 000000000..de64751de --- /dev/null +++ b/arch/mips/pistachio/time.c | |||
@@ -0,0 +1,55 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0-only | ||
2 | /* | ||
3 | * Pistachio clocksource/timer setup | ||
4 | * | ||
5 | * Copyright (C) 2014 Google, Inc. | ||
6 | */ | ||
7 | |||
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> | ||
13 | |||
14 | #include <asm/mips-cps.h> | ||
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 | } | ||
26 | EXPORT_SYMBOL_GPL(get_c0_perfcount_int); | ||
27 | |||
28 | int get_c0_fdc_int(void) | ||
29 | { | ||
30 | return gic_get_c0_fdc_int(); | ||
31 | } | ||
32 | |||
33 | void __init plat_time_init(void) | ||
34 | { | ||
35 | struct device_node *np; | ||
36 | struct clk *clk; | ||
37 | |||
38 | of_clk_init(NULL); | ||
39 | timer_probe(); | ||
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 | } | ||