aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-s3c2443/clock.c
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2008-10-21 09:06:38 -0400
committerBen Dooks <ben-linux@fluff.org>2008-12-15 16:46:08 -0500
commite425382ed90d221ef9031a1b2d97d9bfedcf90c3 (patch)
treeca36882dba4caf8a9726ed67216251360c80ef59 /arch/arm/mach-s3c2443/clock.c
parentc3391e36d697c997b6afeb045071e0be95219a3e (diff)
[ARM] S3C24XX: Update clock data on resume
Update the clock settings on resume for suspend/resume support so that if the boot loader changes anything or the system's PLL is reset then we return with the correct settings. Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch/arm/mach-s3c2443/clock.c')
-rw-r--r--arch/arm/mach-s3c2443/clock.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/arch/arm/mach-s3c2443/clock.c b/arch/arm/mach-s3c2443/clock.c
index f854e7385e3c..1df8429242b8 100644
--- a/arch/arm/mach-s3c2443/clock.c
+++ b/arch/arm/mach-s3c2443/clock.c
@@ -39,6 +39,8 @@
39 39
40#include <mach/regs-s3c2443-clock.h> 40#include <mach/regs-s3c2443-clock.h>
41 41
42#include <plat/cpu-freq.h>
43
42#include <plat/s3c2443.h> 44#include <plat/s3c2443.h>
43#include <plat/clock.h> 45#include <plat/clock.h>
44#include <plat/cpu.h> 46#include <plat/cpu.h>
@@ -1011,22 +1013,20 @@ static struct clk *clks[] __initdata = {
1011 &clk_prediv, 1013 &clk_prediv,
1012}; 1014};
1013 1015
1014void __init s3c2443_init_clocks(int xtal) 1016void __init_or_cpufreq s3c2443_setup_clocks(void)
1015{ 1017{
1016 unsigned long epllcon = __raw_readl(S3C2443_EPLLCON);
1017 unsigned long mpllcon = __raw_readl(S3C2443_MPLLCON); 1018 unsigned long mpllcon = __raw_readl(S3C2443_MPLLCON);
1018 unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0); 1019 unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0);
1020 struct clk *xtal_clk;
1021 unsigned long xtal;
1019 unsigned long pll; 1022 unsigned long pll;
1020 unsigned long fclk; 1023 unsigned long fclk;
1021 unsigned long hclk; 1024 unsigned long hclk;
1022 unsigned long pclk; 1025 unsigned long pclk;
1023 struct clk *clkp;
1024 int ret;
1025 int ptr;
1026 1026
1027 /* s3c2443 parents h and p clocks from prediv */ 1027 xtal_clk = clk_get(NULL, "xtal");
1028 clk_h.parent = &clk_prediv; 1028 xtal = clk_get_rate(xtal_clk);
1029 clk_p.parent = &clk_prediv; 1029 clk_put(xtal_clk);
1030 1030
1031 pll = s3c2443_get_mpll(mpllcon, xtal); 1031 pll = s3c2443_get_mpll(mpllcon, xtal);
1032 clk_msysclk.rate = pll; 1032 clk_msysclk.rate = pll;
@@ -1036,13 +1036,29 @@ void __init s3c2443_init_clocks(int xtal)
1036 hclk /= s3c2443_get_hdiv(clkdiv0); 1036 hclk /= s3c2443_get_hdiv(clkdiv0);
1037 pclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 2 : 1); 1037 pclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 2 : 1);
1038 1038
1039 s3c24xx_setup_clocks(xtal, fclk, hclk, pclk); 1039 s3c24xx_setup_clocks(fclk, hclk, pclk);
1040 1040
1041 printk("S3C2443: mpll %s %ld.%03ld MHz, cpu %ld.%03ld MHz, mem %ld.%03ld MHz, pclk %ld.%03ld MHz\n", 1041 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", 1042 (mpllcon & S3C2443_PLLCON_OFF) ? "off":"on",
1043 print_mhz(pll), print_mhz(fclk), 1043 print_mhz(pll), print_mhz(fclk),
1044 print_mhz(hclk), print_mhz(pclk)); 1044 print_mhz(hclk), print_mhz(pclk));
1045 1045
1046 s3c24xx_setup_clocks(fclk, hclk, pclk);
1047}
1048
1049void __init s3c2443_init_clocks(int xtal)
1050{
1051 struct clk *clkp;
1052 unsigned long epllcon = __raw_readl(S3C2443_EPLLCON);
1053 int ret;
1054 int ptr;
1055
1056 /* s3c2443 parents h and p clocks from prediv */
1057 clk_h.parent = &clk_prediv;
1058 clk_p.parent = &clk_prediv;
1059
1060 s3c24xx_register_baseclocks(xtal);
1061 s3c2443_setup_clocks();
1046 s3c2443_clk_initparents(); 1062 s3c2443_clk_initparents();
1047 1063
1048 for (ptr = 0; ptr < ARRAY_SIZE(clks); ptr++) { 1064 for (ptr = 0; ptr < ARRAY_SIZE(clks); ptr++) {
@@ -1056,7 +1072,6 @@ void __init s3c2443_init_clocks(int xtal)
1056 } 1072 }
1057 1073
1058 clk_epll.rate = s3c2443_get_epll(epllcon, xtal); 1074 clk_epll.rate = s3c2443_get_epll(epllcon, xtal);
1059
1060 clk_usb_bus.parent = &clk_usb_bus_host; 1075 clk_usb_bus.parent = &clk_usb_bus_host;
1061 1076
1062 /* ensure usb bus clock is within correct rate of 48MHz */ 1077 /* ensure usb bus clock is within correct rate of 48MHz */