aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-s3c2443/clock.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-s3c2443/clock.c')
-rw-r--r--arch/arm/mach-s3c2443/clock.c53
1 files changed, 28 insertions, 25 deletions
diff --git a/arch/arm/mach-s3c2443/clock.c b/arch/arm/mach-s3c2443/clock.c
index f854e7385e3c..2785d69c95b0 100644
--- a/arch/arm/mach-s3c2443/clock.c
+++ b/arch/arm/mach-s3c2443/clock.c
@@ -29,7 +29,6 @@
29#include <linux/sysdev.h> 29#include <linux/sysdev.h>
30#include <linux/clk.h> 30#include <linux/clk.h>
31#include <linux/mutex.h> 31#include <linux/mutex.h>
32#include <linux/delay.h>
33#include <linux/serial_core.h> 32#include <linux/serial_core.h>
34#include <linux/io.h> 33#include <linux/io.h>
35 34
@@ -39,6 +38,8 @@
39 38
40#include <mach/regs-s3c2443-clock.h> 39#include <mach/regs-s3c2443-clock.h>
41 40
41#include <plat/cpu-freq.h>
42
42#include <plat/s3c2443.h> 43#include <plat/s3c2443.h>
43#include <plat/clock.h> 44#include <plat/clock.h>
44#include <plat/cpu.h> 45#include <plat/cpu.h>
@@ -145,12 +146,6 @@ static unsigned long s3c2443_roundrate_clksrc256(struct clk *clk,
145 146
146/* clock selections */ 147/* clock selections */
147 148
148/* CPU EXTCLK input */
149static struct clk clk_ext = {
150 .name = "ext",
151 .id = -1,
152};
153
154static struct clk clk_mpllref = { 149static struct clk clk_mpllref = {
155 .name = "mpllref", 150 .name = "mpllref",
156 .parent = &clk_xtal, 151 .parent = &clk_xtal,
@@ -165,14 +160,6 @@ static struct clk clk_mpll = {
165}; 160};
166#endif 161#endif
167 162
168static struct clk clk_epllref;
169
170static struct clk clk_epll = {
171 .name = "epll",
172 .parent = &clk_epllref,
173 .id = -1,
174};
175
176static struct clk clk_i2s_ext = { 163static struct clk clk_i2s_ext = {
177 .name = "i2s-ext", 164 .name = "i2s-ext",
178 .id = -1, 165 .id = -1,
@@ -1011,22 +998,20 @@ static struct clk *clks[] __initdata = {
1011 &clk_prediv, 998 &clk_prediv,
1012}; 999};
1013 1000
1014void __init s3c2443_init_clocks(int xtal) 1001void __init_or_cpufreq s3c2443_setup_clocks(void)
1015{ 1002{
1016 unsigned long epllcon = __raw_readl(S3C2443_EPLLCON);
1017 unsigned long mpllcon = __raw_readl(S3C2443_MPLLCON); 1003 unsigned long mpllcon = __raw_readl(S3C2443_MPLLCON);
1018 unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0); 1004 unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0);
1005 struct clk *xtal_clk;
1006 unsigned long xtal;
1019 unsigned long pll; 1007 unsigned long pll;
1020 unsigned long fclk; 1008 unsigned long fclk;
1021 unsigned long hclk; 1009 unsigned long hclk;
1022 unsigned long pclk; 1010 unsigned long pclk;
1023 struct clk *clkp;
1024 int ret;
1025 int ptr;
1026 1011
1027 /* s3c2443 parents h and p clocks from prediv */ 1012 xtal_clk = clk_get(NULL, "xtal");
1028 clk_h.parent = &clk_prediv; 1013 xtal = clk_get_rate(xtal_clk);
1029 clk_p.parent = &clk_prediv; 1014 clk_put(xtal_clk);
1030 1015
1031 pll = s3c2443_get_mpll(mpllcon, xtal); 1016 pll = s3c2443_get_mpll(mpllcon, xtal);
1032 clk_msysclk.rate = pll; 1017 clk_msysclk.rate = pll;
@@ -1036,13 +1021,29 @@ void __init s3c2443_init_clocks(int xtal)
1036 hclk /= s3c2443_get_hdiv(clkdiv0); 1021 hclk /= s3c2443_get_hdiv(clkdiv0);
1037 pclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 2 : 1); 1022 pclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 2 : 1);
1038 1023
1039 s3c24xx_setup_clocks(xtal, fclk, hclk, pclk); 1024 s3c24xx_setup_clocks(fclk, hclk, pclk);
1040 1025
1041 printk("S3C2443: mpll %s %ld.%03ld MHz, cpu %ld.%03ld MHz, mem %ld.%03ld MHz, pclk %ld.%03ld MHz\n", 1026 printk("S3C2443: mpll %s %ld.%03ld MHz, cpu %ld.%03ld MHz, mem %ld.%03ld MHz, pclk %ld.%03ld MHz\n",
1042 (mpllcon & S3C2443_PLLCON_OFF) ? "off":"on", 1027 (mpllcon & S3C2443_PLLCON_OFF) ? "off":"on",
1043 print_mhz(pll), print_mhz(fclk), 1028 print_mhz(pll), print_mhz(fclk),
1044 print_mhz(hclk), print_mhz(pclk)); 1029 print_mhz(hclk), print_mhz(pclk));
1045 1030
1031 s3c24xx_setup_clocks(fclk, hclk, pclk);
1032}
1033
1034void __init s3c2443_init_clocks(int xtal)
1035{
1036 struct clk *clkp;
1037 unsigned long epllcon = __raw_readl(S3C2443_EPLLCON);
1038 int ret;
1039 int ptr;
1040
1041 /* s3c2443 parents h and p clocks from prediv */
1042 clk_h.parent = &clk_prediv;
1043 clk_p.parent = &clk_prediv;
1044
1045 s3c24xx_register_baseclocks(xtal);
1046 s3c2443_setup_clocks();
1046 s3c2443_clk_initparents(); 1047 s3c2443_clk_initparents();
1047 1048
1048 for (ptr = 0; ptr < ARRAY_SIZE(clks); ptr++) { 1049 for (ptr = 0; ptr < ARRAY_SIZE(clks); ptr++) {
@@ -1056,7 +1057,7 @@ void __init s3c2443_init_clocks(int xtal)
1056 } 1057 }
1057 1058
1058 clk_epll.rate = s3c2443_get_epll(epllcon, xtal); 1059 clk_epll.rate = s3c2443_get_epll(epllcon, xtal);
1059 1060 clk_epll.parent = &clk_epllref;
1060 clk_usb_bus.parent = &clk_usb_bus_host; 1061 clk_usb_bus.parent = &clk_usb_bus_host;
1061 1062
1062 /* ensure usb bus clock is within correct rate of 48MHz */ 1063 /* ensure usb bus clock is within correct rate of 48MHz */
@@ -1105,4 +1106,6 @@ void __init s3c2443_init_clocks(int xtal)
1105 1106
1106 (clkp->enable)(clkp, 0); 1107 (clkp->enable)(clkp, 0);
1107 } 1108 }
1109
1110 s3c_pwmclk_init();
1108} 1111}