mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 14:24:11 +08:00
35f752be4f
ralink only has a very trivial clock implementation, with everything
being fixed clocks.
Convert it to CONFIG_COMMON_CLK to reduce the number of platforms
that rely on legacy clocks. Of course, the clocks really should
be read from the device tree instead, but this is a step into that
direction.
This adds about 50KB to the kernel image size, which is an unfortunate
increase, but not as bad as I had feared:
text data bss dec hex filename
3778560 1582216 92256 5453032 5334e8 vmlinux-vocore-before
3822148 1601192 92304 5515644 54297c vmlinux-vocore-after
3870226 1644468 200192 5714886
5733c6 vmlinux-rt305x-before
3916727 1668404 200240 5785371 58471b vmlinux-rt305x-after
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
44 lines
925 B
C
44 lines
925 B
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
*
|
|
* Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
|
|
* Copyright (C) 2013 John Crispin <john@phrozen.org>
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/init.h>
|
|
#include <linux/export.h>
|
|
#include <linux/clkdev.h>
|
|
#include <linux/clk.h>
|
|
#include <linux/clk-provider.h>
|
|
|
|
#include <asm/time.h>
|
|
|
|
#include "common.h"
|
|
|
|
void ralink_clk_add(const char *dev, unsigned long rate)
|
|
{
|
|
struct clk *clk = clk_register_fixed_rate(NULL, dev, NULL, 0, rate);
|
|
|
|
if (!clk)
|
|
panic("failed to add clock");
|
|
|
|
clkdev_create(clk, NULL, "%s", dev);
|
|
}
|
|
|
|
void __init plat_time_init(void)
|
|
{
|
|
struct clk *clk;
|
|
|
|
ralink_of_remap();
|
|
|
|
ralink_clk_init();
|
|
clk = clk_get_sys("cpu", NULL);
|
|
if (IS_ERR(clk))
|
|
panic("unable to get CPU clock, err=%ld", PTR_ERR(clk));
|
|
pr_info("CPU Clock: %ldMHz\n", clk_get_rate(clk) / 1000000);
|
|
mips_hpt_frequency = clk_get_rate(clk) / 2;
|
|
clk_put(clk);
|
|
timer_probe();
|
|
}
|