diff options
Diffstat (limited to 'arch/mips/loongson32/common/time.c')
-rw-r--r-- | arch/mips/loongson32/common/time.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/mips/loongson32/common/time.c b/arch/mips/loongson32/common/time.c new file mode 100644 index 0000000000..74ad2b1791 --- /dev/null +++ b/arch/mips/loongson32/common/time.c @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2014 Zhang, Keguang <keguang.zhang@gmail.com> + */ + +#include <linux/clk.h> +#include <linux/of_clk.h> +#include <asm/time.h> + +void __init plat_time_init(void) +{ + struct clk *clk = NULL; + + /* initialize LS1X clocks */ + of_clk_init(NULL); + + /* setup mips r4k timer */ + clk = clk_get(NULL, "cpu_clk"); + if (IS_ERR(clk)) + panic("unable to get cpu clock, err=%ld", PTR_ERR(clk)); + + mips_hpt_frequency = clk_get_rate(clk) / 2; +} |