diff options
author | Thomas Abraham <thomas.ab@samsung.com> | 2010-05-16 20:38:37 -0400 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2010-05-16 21:37:35 -0400 |
commit | 0fe967a1ca8845ac227d3cab51e3520ddb310932 (patch) | |
tree | ef5e62881f6980e0cd78b3bfbb14a995ee40b48d /arch/arm/mach-s5pv210/clock.c | |
parent | af76a201c63fd7566bab8892f3b8c82e66a264d0 (diff) |
ARM: S5PV210: Remove usage of clk_h166 and add clk_hclk_dsys clock
The clk_h166 clock, which is the HCLK clock for DSYS domain, is of
type 'struct clk' whereas on S5PV210, this clock is suitable to be
of type clksrc_clk clock (since it has a choice of clock source
and a pre-divider). So this patch replaces the 'struct clk' type
clock to 'struct clksrc_clk' type clock for the HCLK DSYS clock.
This patch modifies the following.
1. Remove definitions and usage of 'clk_h166' clock.
2. Adds 'clk_sclk_a2m' clock which is one of possible parent clock
sources for the DSYS HCLK clock.
3. Adds 'clk_hclk_dsys' clock which is of type 'struct clksrc_clk'.
4. Replace all usage of clk_h166 with clk_hclk_dsys clock.
5. Adds clk_sclk_a2m and clk_hclk_dsys into list of clocks to
be registered.
6. Removes the clock rate calculation of hclk166 and replaces
it with code that derives the HCLK DSYS clock rate from
the clk_hclk_dsys clock.
Signed-off-by: Thomas Abraham <thomas.ab@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch/arm/mach-s5pv210/clock.c')
-rw-r--r-- | arch/arm/mach-s5pv210/clock.c | 55 |
1 files changed, 37 insertions, 18 deletions
diff --git a/arch/arm/mach-s5pv210/clock.c b/arch/arm/mach-s5pv210/clock.c index d5acd261795c..ecffafea7f83 100644 --- a/arch/arm/mach-s5pv210/clock.c +++ b/arch/arm/mach-s5pv210/clock.c | |||
@@ -87,6 +87,35 @@ static struct clksrc_clk clk_hclk_msys = { | |||
87 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 8, .size = 3 }, | 87 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 8, .size = 3 }, |
88 | }; | 88 | }; |
89 | 89 | ||
90 | static struct clksrc_clk clk_sclk_a2m = { | ||
91 | .clk = { | ||
92 | .name = "sclk_a2m", | ||
93 | .id = -1, | ||
94 | .parent = &clk_mout_apll.clk, | ||
95 | }, | ||
96 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 4, .size = 3 }, | ||
97 | }; | ||
98 | |||
99 | static struct clk *clkset_hclk_sys_list[] = { | ||
100 | [0] = &clk_mout_mpll.clk, | ||
101 | [1] = &clk_sclk_a2m.clk, | ||
102 | }; | ||
103 | |||
104 | static struct clksrc_sources clkset_hclk_sys = { | ||
105 | .sources = clkset_hclk_sys_list, | ||
106 | .nr_sources = ARRAY_SIZE(clkset_hclk_sys_list), | ||
107 | }; | ||
108 | |||
109 | static struct clksrc_clk clk_hclk_dsys = { | ||
110 | .clk = { | ||
111 | .name = "hclk_dsys", | ||
112 | .id = -1, | ||
113 | }, | ||
114 | .sources = &clkset_hclk_sys, | ||
115 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 20, .size = 1 }, | ||
116 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 16, .size = 4 }, | ||
117 | }; | ||
118 | |||
90 | static int s5pv210_clk_ip0_ctrl(struct clk *clk, int enable) | 119 | static int s5pv210_clk_ip0_ctrl(struct clk *clk, int enable) |
91 | { | 120 | { |
92 | return s5p_gatectrl(S5P_CLKGATE_IP0, clk, enable); | 121 | return s5p_gatectrl(S5P_CLKGATE_IP0, clk, enable); |
@@ -112,11 +141,6 @@ static struct clk clk_h100 = { | |||
112 | .id = -1, | 141 | .id = -1, |
113 | }; | 142 | }; |
114 | 143 | ||
115 | static struct clk clk_h166 = { | ||
116 | .name = "hclk166", | ||
117 | .id = -1, | ||
118 | }; | ||
119 | |||
120 | static struct clk clk_h133 = { | 144 | static struct clk clk_h133 = { |
121 | .name = "hclk133", | 145 | .name = "hclk133", |
122 | .id = -1, | 146 | .id = -1, |
@@ -139,7 +163,6 @@ static struct clk clk_p66 = { | |||
139 | 163 | ||
140 | static struct clk *sys_clks[] = { | 164 | static struct clk *sys_clks[] = { |
141 | &clk_h100, | 165 | &clk_h100, |
142 | &clk_h166, | ||
143 | &clk_h133, | 166 | &clk_h133, |
144 | &clk_p100, | 167 | &clk_p100, |
145 | &clk_p83, | 168 | &clk_p83, |
@@ -150,7 +173,7 @@ static struct clk init_clocks_disable[] = { | |||
150 | { | 173 | { |
151 | .name = "rot", | 174 | .name = "rot", |
152 | .id = -1, | 175 | .id = -1, |
153 | .parent = &clk_h166, | 176 | .parent = &clk_hclk_dsys.clk, |
154 | .enable = s5pv210_clk_ip0_ctrl, | 177 | .enable = s5pv210_clk_ip0_ctrl, |
155 | .ctrlbit = (1<<29), | 178 | .ctrlbit = (1<<29), |
156 | }, { | 179 | }, { |
@@ -168,7 +191,7 @@ static struct clk init_clocks_disable[] = { | |||
168 | }, { | 191 | }, { |
169 | .name = "lcd", | 192 | .name = "lcd", |
170 | .id = -1, | 193 | .id = -1, |
171 | .parent = &clk_h166, | 194 | .parent = &clk_hclk_dsys.clk, |
172 | .enable = s5pv210_clk_ip1_ctrl, | 195 | .enable = s5pv210_clk_ip1_ctrl, |
173 | .ctrlbit = (1<<0), | 196 | .ctrlbit = (1<<0), |
174 | }, { | 197 | }, { |
@@ -353,6 +376,8 @@ static struct clksrc_clk *sysclks[] = { | |||
353 | &clk_mout_mpll, | 376 | &clk_mout_mpll, |
354 | &clk_armclk, | 377 | &clk_armclk, |
355 | &clk_hclk_msys, | 378 | &clk_hclk_msys, |
379 | &clk_sclk_a2m, | ||
380 | &clk_hclk_dsys, | ||
356 | }; | 381 | }; |
357 | 382 | ||
358 | #define GET_DIV(clk, field) ((((clk) & field##_MASK) >> field##_SHIFT) + 1) | 383 | #define GET_DIV(clk, field) ((((clk) & field##_MASK) >> field##_SHIFT) + 1) |
@@ -363,7 +388,7 @@ void __init_or_cpufreq s5pv210_setup_clocks(void) | |||
363 | unsigned long xtal; | 388 | unsigned long xtal; |
364 | unsigned long armclk; | 389 | unsigned long armclk; |
365 | unsigned long hclk_msys; | 390 | unsigned long hclk_msys; |
366 | unsigned long hclk166; | 391 | unsigned long hclk_dsys; |
367 | unsigned long hclk133; | 392 | unsigned long hclk133; |
368 | unsigned long pclk100; | 393 | unsigned long pclk100; |
369 | unsigned long pclk83; | 394 | unsigned long pclk83; |
@@ -403,12 +428,7 @@ void __init_or_cpufreq s5pv210_setup_clocks(void) | |||
403 | 428 | ||
404 | armclk = clk_get_rate(&clk_armclk.clk); | 429 | armclk = clk_get_rate(&clk_armclk.clk); |
405 | hclk_msys = clk_get_rate(&clk_hclk_msys.clk); | 430 | hclk_msys = clk_get_rate(&clk_hclk_msys.clk); |
406 | 431 | hclk_dsys = clk_get_rate(&clk_hclk_dsys.clk); | |
407 | if (__raw_readl(S5P_CLK_SRC0) & S5P_CLKSRC0_MUX166_MASK) { | ||
408 | hclk166 = apll / GET_DIV(clkdiv0, S5P_CLKDIV0_A2M); | ||
409 | hclk166 = hclk166 / GET_DIV(clkdiv0, S5P_CLKDIV0_HCLK166); | ||
410 | } else | ||
411 | hclk166 = mpll / GET_DIV(clkdiv0, S5P_CLKDIV0_HCLK166); | ||
412 | 432 | ||
413 | if (__raw_readl(S5P_CLK_SRC0) & S5P_CLKSRC0_MUX133_MASK) { | 433 | if (__raw_readl(S5P_CLK_SRC0) & S5P_CLKSRC0_MUX133_MASK) { |
414 | hclk133 = apll / GET_DIV(clkdiv0, S5P_CLKDIV0_A2M); | 434 | hclk133 = apll / GET_DIV(clkdiv0, S5P_CLKDIV0_A2M); |
@@ -417,12 +437,12 @@ void __init_or_cpufreq s5pv210_setup_clocks(void) | |||
417 | hclk133 = mpll / GET_DIV(clkdiv0, S5P_CLKDIV0_HCLK133); | 437 | hclk133 = mpll / GET_DIV(clkdiv0, S5P_CLKDIV0_HCLK133); |
418 | 438 | ||
419 | pclk100 = hclk_msys / GET_DIV(clkdiv0, S5P_CLKDIV0_PCLK100); | 439 | pclk100 = hclk_msys / GET_DIV(clkdiv0, S5P_CLKDIV0_PCLK100); |
420 | pclk83 = hclk166 / GET_DIV(clkdiv0, S5P_CLKDIV0_PCLK83); | 440 | pclk83 = hclk_dsys / GET_DIV(clkdiv0, S5P_CLKDIV0_PCLK83); |
421 | pclk66 = hclk133 / GET_DIV(clkdiv0, S5P_CLKDIV0_PCLK66); | 441 | pclk66 = hclk133 / GET_DIV(clkdiv0, S5P_CLKDIV0_PCLK66); |
422 | 442 | ||
423 | printk(KERN_INFO "S5PV210: ARMCLK=%ld, HCLKM=%ld, HCLKD=%ld, \ | 443 | printk(KERN_INFO "S5PV210: ARMCLK=%ld, HCLKM=%ld, HCLKD=%ld, \ |
424 | HCLKP=%ld, PCLKM=%ld, PCLKD=%ld, PCLKP=%ld\n", | 444 | HCLKP=%ld, PCLKM=%ld, PCLKD=%ld, PCLKP=%ld\n", |
425 | armclk, hclk_msys, hclk166, hclk133, pclk100, pclk83, pclk66); | 445 | armclk, hclk_msys, hclk_dsys, hclk133, pclk100, pclk83, pclk66); |
426 | 446 | ||
427 | clk_f.rate = armclk; | 447 | clk_f.rate = armclk; |
428 | clk_h.rate = hclk133; | 448 | clk_h.rate = hclk133; |
@@ -430,7 +450,6 @@ void __init_or_cpufreq s5pv210_setup_clocks(void) | |||
430 | clk_p66.rate = pclk66; | 450 | clk_p66.rate = pclk66; |
431 | clk_p83.rate = pclk83; | 451 | clk_p83.rate = pclk83; |
432 | clk_h133.rate = hclk133; | 452 | clk_h133.rate = hclk133; |
433 | clk_h166.rate = hclk166; | ||
434 | 453 | ||
435 | for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) | 454 | for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) |
436 | s3c_set_clksrc(&clksrcs[ptr], true); | 455 | s3c_set_clksrc(&clksrcs[ptr], true); |