blob: 07133defa148dbbe2da9216a66fae3b09dabaefd [file] [log] [blame]
Kelvin Cheungca585cf2012-07-25 16:17:24 +02001/*
2 * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 */
9
Kelvin Cheungca585cf2012-07-25 16:17:24 +020010#include <linux/clk.h>
11#include <linux/err.h>
Kelvin Cheungca585cf2012-07-25 16:17:24 +020012#include <asm/time.h>
Kelvin Cheung17ded0a2012-10-23 05:17:00 +000013#include <platform.h>
Kelvin Cheungca585cf2012-07-25 16:17:24 +020014
15void __init plat_time_init(void)
16{
17 struct clk *clk;
18
19 /* Initialize LS1X clocks */
Kelvin Cheung17ded0a2012-10-23 05:17:00 +000020 ls1x_clk_init();
Kelvin Cheungca585cf2012-07-25 16:17:24 +020021
22 /* setup mips r4k timer */
23 clk = clk_get(NULL, "cpu");
24 if (IS_ERR(clk))
Kelvin Cheung69b18032012-10-23 05:17:03 +000025 panic("unable to get cpu clock, err=%ld", PTR_ERR(clk));
Kelvin Cheungca585cf2012-07-25 16:17:24 +020026
27 mips_hpt_frequency = clk_get_rate(clk) / 2;
28}