Kelvin Cheung | ca585cf | 2012-07-25 16:17:24 +0200 | [diff] [blame] | 1 | /* |
| 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 Cheung | ca585cf | 2012-07-25 16:17:24 +0200 | [diff] [blame] | 10 | #include <linux/clk.h> |
| 11 | #include <linux/err.h> |
Kelvin Cheung | ca585cf | 2012-07-25 16:17:24 +0200 | [diff] [blame] | 12 | #include <asm/time.h> |
Kelvin Cheung | 17ded0a | 2012-10-23 05:17:00 +0000 | [diff] [blame] | 13 | #include <platform.h> |
Kelvin Cheung | ca585cf | 2012-07-25 16:17:24 +0200 | [diff] [blame] | 14 | |
| 15 | void __init plat_time_init(void) |
| 16 | { |
| 17 | struct clk *clk; |
| 18 | |
| 19 | /* Initialize LS1X clocks */ |
Kelvin Cheung | 17ded0a | 2012-10-23 05:17:00 +0000 | [diff] [blame] | 20 | ls1x_clk_init(); |
Kelvin Cheung | ca585cf | 2012-07-25 16:17:24 +0200 | [diff] [blame] | 21 | |
| 22 | /* setup mips r4k timer */ |
| 23 | clk = clk_get(NULL, "cpu"); |
| 24 | if (IS_ERR(clk)) |
Kelvin Cheung | 69b1803 | 2012-10-23 05:17:03 +0000 | [diff] [blame] | 25 | panic("unable to get cpu clock, err=%ld", PTR_ERR(clk)); |
Kelvin Cheung | ca585cf | 2012-07-25 16:17:24 +0200 | [diff] [blame] | 26 | |
| 27 | mips_hpt_frequency = clk_get_rate(clk) / 2; |
| 28 | } |