diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2013-04-05 00:22:16 -0400 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2013-06-07 01:24:45 -0400 |
commit | b89edf344696e7783312a370b6477beea90116f9 (patch) | |
tree | 2a8b5cd90a40dc4833bc2ee098428398f2d41780 | |
parent | 0c3091ad45ac975244a7c0570e10b645743bb01c (diff) |
ARM: shmobile: r8a73a4: add div4 clocks
DIV4 clocks control each core clocks.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-rw-r--r-- | arch/arm/mach-shmobile/clock-r8a73a4.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/clock-r8a73a4.c b/arch/arm/mach-shmobile/clock-r8a73a4.c index 2be592f6dbc0..147314ac6a14 100644 --- a/arch/arm/mach-shmobile/clock-r8a73a4.c +++ b/arch/arm/mach-shmobile/clock-r8a73a4.c | |||
@@ -32,6 +32,8 @@ | |||
32 | #define SMSTPCR2 0xe6150138 | 32 | #define SMSTPCR2 0xe6150138 |
33 | #define SMSTPCR5 0xe6150144 | 33 | #define SMSTPCR5 0xe6150144 |
34 | 34 | ||
35 | #define FRQCRA 0xE6150000 | ||
36 | #define FRQCRB 0xE6150004 | ||
35 | #define CKSCR 0xE61500C0 | 37 | #define CKSCR 0xE61500C0 |
36 | #define PLLECR 0xE61500D0 | 38 | #define PLLECR 0xE61500D0 |
37 | #define PLL1CR 0xE6150028 | 39 | #define PLL1CR 0xE6150028 |
@@ -175,6 +177,46 @@ static struct clk *main_clks[] = { | |||
175 | &pll2h_clk, | 177 | &pll2h_clk, |
176 | }; | 178 | }; |
177 | 179 | ||
180 | /* DIV4 */ | ||
181 | static void div4_kick(struct clk *clk) | ||
182 | { | ||
183 | unsigned long value; | ||
184 | |||
185 | /* set KICK bit in FRQCRB to update hardware setting */ | ||
186 | value = ioread32(CPG_MAP(FRQCRB)); | ||
187 | value |= (1 << 31); | ||
188 | iowrite32(value, CPG_MAP(FRQCRB)); | ||
189 | } | ||
190 | |||
191 | static int divisors[] = { 2, 3, 4, 6, 8, 12, 16, 18, 24, 0, 36, 48, 10}; | ||
192 | |||
193 | static struct clk_div_mult_table div4_div_mult_table = { | ||
194 | .divisors = divisors, | ||
195 | .nr_divisors = ARRAY_SIZE(divisors), | ||
196 | }; | ||
197 | |||
198 | static struct clk_div4_table div4_table = { | ||
199 | .div_mult_table = &div4_div_mult_table, | ||
200 | .kick = div4_kick, | ||
201 | }; | ||
202 | |||
203 | enum { | ||
204 | DIV4_I, DIV4_M3, DIV4_B, DIV4_M1, DIV4_M2, | ||
205 | DIV4_ZX, DIV4_ZS, DIV4_HP, | ||
206 | DIV4_NR }; | ||
207 | |||
208 | static struct clk div4_clks[DIV4_NR] = { | ||
209 | [DIV4_I] = SH_CLK_DIV4(&pll1_clk, FRQCRA, 20, 0x0dff, CLK_ENABLE_ON_INIT), | ||
210 | [DIV4_M3] = SH_CLK_DIV4(&pll1_clk, FRQCRA, 12, 0x1dff, CLK_ENABLE_ON_INIT), | ||
211 | [DIV4_B] = SH_CLK_DIV4(&pll1_clk, FRQCRA, 8, 0x0dff, CLK_ENABLE_ON_INIT), | ||
212 | [DIV4_M1] = SH_CLK_DIV4(&pll1_clk, FRQCRA, 4, 0x1dff, 0), | ||
213 | [DIV4_M2] = SH_CLK_DIV4(&pll1_clk, FRQCRA, 0, 0x1dff, 0), | ||
214 | [DIV4_ZX] = SH_CLK_DIV4(&pll1_clk, FRQCRB, 12, 0x0dff, 0), | ||
215 | [DIV4_ZS] = SH_CLK_DIV4(&pll1_clk, FRQCRB, 8, 0x0dff, 0), | ||
216 | [DIV4_HP] = SH_CLK_DIV4(&pll1_clk, FRQCRB, 4, 0x0dff, 0), | ||
217 | }; | ||
218 | |||
219 | /* MSTP */ | ||
178 | enum { | 220 | enum { |
179 | MSTP217, MSTP216, MSTP207, MSTP206, MSTP204, MSTP203, | 221 | MSTP217, MSTP216, MSTP207, MSTP206, MSTP204, MSTP203, |
180 | MSTP522, | 222 | MSTP522, |
@@ -258,6 +300,9 @@ void __init r8a73a4_clock_init(void) | |||
258 | ret = clk_register(main_clks[k]); | 300 | ret = clk_register(main_clks[k]); |
259 | 301 | ||
260 | if (!ret) | 302 | if (!ret) |
303 | ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table); | ||
304 | |||
305 | if (!ret) | ||
261 | ret = sh_clk_mstp_register(mstp_clks, MSTP_NR); | 306 | ret = sh_clk_mstp_register(mstp_clks, MSTP_NR); |
262 | 307 | ||
263 | clkdev_add_table(lookups, ARRAY_SIZE(lookups)); | 308 | clkdev_add_table(lookups, ARRAY_SIZE(lookups)); |