accel/qaic: Add AIC200 support
[drm/drm-misc.git] / arch / mips / loongson64 / time.c
blobf6d2c1e305706a524248f0e8cfd60aa5884b242c
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology
4 * Author: Fuxin Zhang, zhangfx@lemote.com
6 * Copyright (C) 2009 Lemote Inc.
7 * Author: Wu Zhangjin, wuzhangjin@gmail.com
8 */
10 #include <asm/time.h>
11 #include <asm/hpet.h>
13 #include <loongson.h>
14 #include <linux/clk.h>
15 #include <linux/of_clk.h>
17 void __init plat_time_init(void)
19 struct clk *clk;
20 struct device_node *np;
22 if (loongson_sysconf.fw_interface == LOONGSON_DTB) {
23 of_clk_init(NULL);
25 np = of_get_cpu_node(0, NULL);
26 if (!np) {
27 pr_err("Failed to get CPU node\n");
28 return;
31 clk = of_clk_get(np, 0);
32 if (IS_ERR(clk)) {
33 pr_err("Failed to get CPU clock: %ld\n", PTR_ERR(clk));
34 return;
37 cpu_clock_freq = clk_get_rate(clk);
38 clk_put(clk);
41 /* setup mips r4k timer */
42 mips_hpt_frequency = cpu_clock_freq / 2;
44 #ifdef CONFIG_RS780_HPET
45 setup_hpet_timer();
46 #endif