xref: /openbmc/linux/arch/mips/ar7/time.c (revision 55fd7e02)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Carsten Langgaard, carstenl@mips.com
4  * Copyright (C) 1999,2000 MIPS Technologies, Inc.  All rights reserved.
5  *
6  * Setting up the clock on the MIPS boards.
7  */
8 
9 #include <linux/init.h>
10 #include <linux/time.h>
11 #include <linux/err.h>
12 #include <linux/clk.h>
13 
14 #include <asm/time.h>
15 #include <asm/mach-ar7/ar7.h>
16 
17 void __init plat_time_init(void)
18 {
19 	struct clk *cpu_clk;
20 
21 	/* Initialize ar7 clocks so the CPU clock frequency is correct */
22 	ar7_init_clocks();
23 
24 	cpu_clk = clk_get(NULL, "cpu");
25 	if (IS_ERR(cpu_clk)) {
26 		printk(KERN_ERR "unable to get cpu clock\n");
27 		return;
28 	}
29 
30 	mips_hpt_frequency = clk_get_rate(cpu_clk) / 2;
31 }
32