1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2013 John Crispin <john@phrozen.org>
8 #include <linux/kernel.h>
9 #include <linux/init.h>
10 #include <linux/export.h>
11 #include <linux/clkdev.h>
12 #include <linux/clk.h>
23 void ralink_clk_add(const char *dev, unsigned long rate)
25 struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL);
28 panic("failed to add clock");
41 int clk_enable(struct clk *clk)
45 EXPORT_SYMBOL_GPL(clk_enable);
47 void clk_disable(struct clk *clk)
50 EXPORT_SYMBOL_GPL(clk_disable);
52 unsigned long clk_get_rate(struct clk *clk)
59 EXPORT_SYMBOL_GPL(clk_get_rate);
61 int clk_set_rate(struct clk *clk, unsigned long rate)
65 EXPORT_SYMBOL_GPL(clk_set_rate);
67 long clk_round_rate(struct clk *clk, unsigned long rate)
71 EXPORT_SYMBOL_GPL(clk_round_rate);
73 void __init plat_time_init(void)
80 clk = clk_get_sys("cpu", NULL);
82 panic("unable to get CPU clock, err=%ld", PTR_ERR(clk));
83 pr_info("CPU Clock: %ldMHz\n", clk_get_rate(clk) / 1000000);
84 mips_hpt_frequency = clk_get_rate(clk) / 2;