diff options
author | Thomas Abraham <thomas.ab@samsung.com> | 2010-05-12 20:27:17 -0400 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2010-05-12 21:42:46 -0400 |
commit | 93ad94db5509ccac65a57f6fc599d61a61767efc (patch) | |
tree | 1f712e812b0e03b65bd71e1ef2c120d1df406c72 /arch/arm/mach-s5p6440 | |
parent | 47051461ab1cc8049e676902bf1972268bed4b9a (diff) |
ARM: S5P6440: Remove usage of clk_h_low and add clk_hclk_low clock
The clk_h_low clock is of type 'struct clk' whereas on S5P6440,
the hclk_low clock is more suitable to be of type 'struct clksrc_clk'
(since hclk_low clock is derived from a choice of clock sources and
then divided by a divisor).
This patch modifies the following.
1. Removes the definition and usage of clk_h_clk clock.
2. Adds the clk_hclk_low clock of type 'struct clksrc_clk' clock.
3. Adds clk_hclk_low to the list of system clocks.
4. The clock rate of hclk_low is derived from the clk_hclk_low 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-s5p6440')
-rw-r--r-- | arch/arm/mach-s5p6440/clock.c | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/arch/arm/mach-s5p6440/clock.c b/arch/arm/mach-s5p6440/clock.c index 61bc85b098ff..c70b3a4075e9 100644 --- a/arch/arm/mach-s5p6440/clock.c +++ b/arch/arm/mach-s5p6440/clock.c | |||
@@ -134,15 +134,6 @@ static struct clksrc_clk clk_mout_mpll = { | |||
134 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 1, .size = 1 }, | 134 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 1, .size = 1 }, |
135 | }; | 135 | }; |
136 | 136 | ||
137 | static struct clk clk_h_low = { | ||
138 | .name = "hclk_low", | ||
139 | .id = -1, | ||
140 | .rate = 0, | ||
141 | .parent = NULL, | ||
142 | .ctrlbit = 0, | ||
143 | .ops = &clk_ops_def_setrate, | ||
144 | }; | ||
145 | |||
146 | static struct clk clk_p_low = { | 137 | static struct clk clk_p_low = { |
147 | .name = "pclk_low", | 138 | .name = "pclk_low", |
148 | .id = -1, | 139 | .id = -1, |
@@ -284,6 +275,26 @@ static struct clksrc_clk clk_pclk = { | |||
284 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 12, .size = 4 }, | 275 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 12, .size = 4 }, |
285 | }; | 276 | }; |
286 | 277 | ||
278 | static struct clk *clkset_hclklow_list[] = { | ||
279 | &clk_mout_apll.clk, | ||
280 | &clk_mout_mpll.clk, | ||
281 | }; | ||
282 | |||
283 | static struct clksrc_sources clkset_hclklow = { | ||
284 | .sources = clkset_hclklow_list, | ||
285 | .nr_sources = ARRAY_SIZE(clkset_hclklow_list), | ||
286 | }; | ||
287 | |||
288 | static struct clksrc_clk clk_hclk_low = { | ||
289 | .clk = { | ||
290 | .name = "hclk_low", | ||
291 | .id = -1, | ||
292 | }, | ||
293 | .sources = &clkset_hclklow, | ||
294 | .reg_src = { .reg = S5P_SYS_OTHERS, .shift = 6, .size = 1 }, | ||
295 | .reg_div = { .reg = S5P_CLK_DIV3, .shift = 8, .size = 4 }, | ||
296 | }; | ||
297 | |||
287 | int s5p6440_clk48m_ctrl(struct clk *clk, int enable) | 298 | int s5p6440_clk48m_ctrl(struct clk *clk, int enable) |
288 | { | 299 | { |
289 | unsigned long flags; | 300 | unsigned long flags; |
@@ -405,37 +416,37 @@ static struct clk init_clocks_disable[] = { | |||
405 | }, { | 416 | }, { |
406 | .name = "otg", | 417 | .name = "otg", |
407 | .id = -1, | 418 | .id = -1, |
408 | .parent = &clk_h_low, | 419 | .parent = &clk_hclk_low.clk, |
409 | .enable = s5p6440_hclk0_ctrl, | 420 | .enable = s5p6440_hclk0_ctrl, |
410 | .ctrlbit = S5P_CLKCON_HCLK0_USB | 421 | .ctrlbit = S5P_CLKCON_HCLK0_USB |
411 | }, { | 422 | }, { |
412 | .name = "post", | 423 | .name = "post", |
413 | .id = -1, | 424 | .id = -1, |
414 | .parent = &clk_h_low, | 425 | .parent = &clk_hclk_low.clk, |
415 | .enable = s5p6440_hclk0_ctrl, | 426 | .enable = s5p6440_hclk0_ctrl, |
416 | .ctrlbit = S5P_CLKCON_HCLK0_POST0 | 427 | .ctrlbit = S5P_CLKCON_HCLK0_POST0 |
417 | }, { | 428 | }, { |
418 | .name = "lcd", | 429 | .name = "lcd", |
419 | .id = -1, | 430 | .id = -1, |
420 | .parent = &clk_h_low, | 431 | .parent = &clk_hclk_low.clk, |
421 | .enable = s5p6440_hclk1_ctrl, | 432 | .enable = s5p6440_hclk1_ctrl, |
422 | .ctrlbit = S5P_CLKCON_HCLK1_DISPCON, | 433 | .ctrlbit = S5P_CLKCON_HCLK1_DISPCON, |
423 | }, { | 434 | }, { |
424 | .name = "hsmmc", | 435 | .name = "hsmmc", |
425 | .id = 0, | 436 | .id = 0, |
426 | .parent = &clk_h_low, | 437 | .parent = &clk_hclk_low.clk, |
427 | .enable = s5p6440_hclk0_ctrl, | 438 | .enable = s5p6440_hclk0_ctrl, |
428 | .ctrlbit = S5P_CLKCON_HCLK0_HSMMC0, | 439 | .ctrlbit = S5P_CLKCON_HCLK0_HSMMC0, |
429 | }, { | 440 | }, { |
430 | .name = "hsmmc", | 441 | .name = "hsmmc", |
431 | .id = 1, | 442 | .id = 1, |
432 | .parent = &clk_h_low, | 443 | .parent = &clk_hclk_low.clk, |
433 | .enable = s5p6440_hclk0_ctrl, | 444 | .enable = s5p6440_hclk0_ctrl, |
434 | .ctrlbit = S5P_CLKCON_HCLK0_HSMMC1, | 445 | .ctrlbit = S5P_CLKCON_HCLK0_HSMMC1, |
435 | }, { | 446 | }, { |
436 | .name = "hsmmc", | 447 | .name = "hsmmc", |
437 | .id = 2, | 448 | .id = 2, |
438 | .parent = &clk_h_low, | 449 | .parent = &clk_hclk_low.clk, |
439 | .enable = s5p6440_hclk0_ctrl, | 450 | .enable = s5p6440_hclk0_ctrl, |
440 | .ctrlbit = S5P_CLKCON_HCLK0_HSMMC2, | 451 | .ctrlbit = S5P_CLKCON_HCLK0_HSMMC2, |
441 | }, { | 452 | }, { |
@@ -600,6 +611,7 @@ static struct clksrc_clk *sysclks[] = { | |||
600 | &clk_armclk, | 611 | &clk_armclk, |
601 | &clk_hclk, | 612 | &clk_hclk, |
602 | &clk_pclk, | 613 | &clk_pclk, |
614 | &clk_hclk_low, | ||
603 | }; | 615 | }; |
604 | 616 | ||
605 | void __init_or_cpufreq s5p6440_setup_clocks(void) | 617 | void __init_or_cpufreq s5p6440_setup_clocks(void) |
@@ -650,15 +662,7 @@ void __init_or_cpufreq s5p6440_setup_clocks(void) | |||
650 | fclk = clk_get_rate(&clk_armclk.clk); | 662 | fclk = clk_get_rate(&clk_armclk.clk); |
651 | hclk = clk_get_rate(&clk_hclk.clk); | 663 | hclk = clk_get_rate(&clk_hclk.clk); |
652 | pclk = clk_get_rate(&clk_pclk.clk); | 664 | pclk = clk_get_rate(&clk_pclk.clk); |
653 | 665 | hclk_low = clk_get_rate(&clk_hclk_low.clk); | |
654 | if (__raw_readl(S5P_OTHERS) & S5P_OTHERS_HCLK_LOW_SEL_MPLL) { | ||
655 | /* Asynchronous mode */ | ||
656 | hclk_low = mpll / GET_DIV(clkdiv3, S5P_CLKDIV3_HCLK_LOW); | ||
657 | } else { | ||
658 | /* Synchronous mode */ | ||
659 | hclk_low = apll / GET_DIV(clkdiv3, S5P_CLKDIV3_HCLK_LOW); | ||
660 | } | ||
661 | |||
662 | pclk_low = hclk_low / GET_DIV(clkdiv3, S5P_CLKDIV3_PCLK_LOW); | 666 | pclk_low = hclk_low / GET_DIV(clkdiv3, S5P_CLKDIV3_PCLK_LOW); |
663 | 667 | ||
664 | printk(KERN_INFO "S5P6440: HCLK=%ld.%ldMHz, HCLK_LOW=%ld.%ldMHz," \ | 668 | printk(KERN_INFO "S5P6440: HCLK=%ld.%ldMHz, HCLK_LOW=%ld.%ldMHz," \ |
@@ -669,7 +673,6 @@ void __init_or_cpufreq s5p6440_setup_clocks(void) | |||
669 | clk_f.rate = fclk; | 673 | clk_f.rate = fclk; |
670 | clk_h.rate = hclk; | 674 | clk_h.rate = hclk; |
671 | clk_p.rate = pclk; | 675 | clk_p.rate = pclk; |
672 | clk_h_low.rate = hclk_low; | ||
673 | clk_p_low.rate = pclk_low; | 676 | clk_p_low.rate = pclk_low; |
674 | 677 | ||
675 | for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) | 678 | for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) |
@@ -681,7 +684,6 @@ static struct clk *clks[] __initdata = { | |||
681 | &clk_iis_cd_v40, | 684 | &clk_iis_cd_v40, |
682 | &clk_pcm_cd, | 685 | &clk_pcm_cd, |
683 | &clk_p_low, | 686 | &clk_p_low, |
684 | &clk_h_low, | ||
685 | }; | 687 | }; |
686 | 688 | ||
687 | void __init s5p6440_register_clocks(void) | 689 | void __init s5p6440_register_clocks(void) |