xref: /openbmc/linux/arch/mips/loongson32/common/time.c (revision c5a06fdc)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (c) 2014 Zhang, Keguang <keguang.zhang@gmail.com>
4  */
5 
6 #include <linux/clk.h>
7 #include <linux/of_clk.h>
8 #include <asm/time.h>
9 
10 void __init plat_time_init(void)
11 {
12 	struct clk *clk = NULL;
13 
14 	/* initialize LS1X clocks */
15 	of_clk_init(NULL);
16 
17 	/* setup mips r4k timer */
18 	clk = clk_get(NULL, "cpu_clk");
19 	if (IS_ERR(clk))
20 		panic("unable to get cpu clock, err=%ld", PTR_ERR(clk));
21 
22 	mips_hpt_frequency = clk_get_rate(clk) / 2;
23 }
24