From 6af713a226f92e5c652b0024e26579c2142f9743 Mon Sep 17 00:00:00 2001 From: xxx Date: Mon, 25 Jun 2012 23:14:07 -0700 Subject: [PATCH] gpll support 300M --- arch/arm/mach-rk30/clock.c | 14 ++++++++++++++ arch/arm/mach-rk30/clock_data.c | 15 ++++++++++++--- arch/arm/mach-rk30/cpufreq.c | 32 +++++++++++++++++++++++++++++--- 3 files changed, 55 insertions(+), 6 deletions(-) mode change 100644 => 100755 arch/arm/mach-rk30/clock.c diff --git a/arch/arm/mach-rk30/clock.c b/arch/arm/mach-rk30/clock.c old mode 100644 new mode 100755 index e0afe5b05819..264642ed1d3e --- a/arch/arm/mach-rk30/clock.c +++ b/arch/arm/mach-rk30/clock.c @@ -437,6 +437,20 @@ int clk_set_parent(struct clk *clk, struct clk *parent) return ret; } +int clk_set_parent_force(struct clk *clk, struct clk *parent) +{ + int ret = -EINVAL; + + if (clk == NULL || IS_ERR(clk) || parent == NULL || IS_ERR(parent)) + return ret; + + if (clk->set_parent==NULL||clk->parents == NULL) + return ret; + LOCK(); + ret = clk_set_parent_nolock(clk, parent); + UNLOCK(); + return ret; +} #ifdef RK30_CLK_OFFBOARD_TEST EXPORT_SYMBOL(rk30_clk_set_parent); diff --git a/arch/arm/mach-rk30/clock_data.c b/arch/arm/mach-rk30/clock_data.c index 98306de6ec21..1f24fcb58309 100644 --- a/arch/arm/mach-rk30/clock_data.c +++ b/arch/arm/mach-rk30/clock_data.c @@ -3198,15 +3198,24 @@ static void periph_clk_set_init(void) aclk_p = aclk_p>>3;// 0 hclk_p = aclk_p>>1; pclk_p = aclk_p>>2; - default: - ppll_rate = 297 * MHZ; + case 297 * MHZ: aclk_p = ppll_rate>>1; hclk_p = aclk_p>>0; pclk_p = aclk_p>>1; break; + + case 300 * MHZ: + aclk_p = ppll_rate>>1; + hclk_p = aclk_p>>0; + pclk_p = aclk_p>>1; + break; + default: + aclk_p = 150 * MHZ; + hclk_p = 150 * MHZ; + pclk_p = 75 * MHZ; + break; } - clk_set_parent_nolock(&aclk_periph, &general_pll_clk); clk_set_rate_nolock(&aclk_periph, aclk_p); clk_set_rate_nolock(&hclk_periph, hclk_p); diff --git a/arch/arm/mach-rk30/cpufreq.c b/arch/arm/mach-rk30/cpufreq.c index 007867f2afb8..90bf09643aad 100755 --- a/arch/arm/mach-rk30/cpufreq.c +++ b/arch/arm/mach-rk30/cpufreq.c @@ -61,6 +61,10 @@ static unsigned int suspend_freq = 816 * 1000; static struct workqueue_struct *freq_wq; static struct clk *cpu_clk; +static struct clk *cpu_pll; +static struct clk *cpu_gpll; + + static DEFINE_MUTEX(cpufreq_mutex); static struct clk *gpu_clk; @@ -234,6 +238,10 @@ static int rk30_cpu_init(struct cpufreq_policy *policy) } cpu_clk = clk_get(NULL, "cpu"); + + cpu_pll = clk_get(NULL, "arm_pll"); + + cpu_gpll = clk_get(NULL, "arm_gpll"); if (IS_ERR(cpu_clk)) return PTR_ERR(cpu_clk); @@ -392,7 +400,7 @@ static void ff_scale_votlage(char *name, int volt) } } - +int clk_set_parent_force(struct clk *clk, struct clk *parent); static void ff_early_suspend_func(struct early_suspend *h) { char buf[32]; @@ -415,7 +423,17 @@ static void ff_early_suspend_func(struct early_suspend *h) FF_ERROR("set speed to 252MHz error\n"); return ; } - + + if (!IS_ERR(cpu_pll)&&!IS_ERR(cpu_gpll)&&!IS_ERR(cpu_clk)) + { + clk_set_parent_force(cpu_clk,cpu_gpll); + clk_set_rate(cpu_clk,300*1000*1000); + + clk_disable_dvfs(cpu_clk); + } + if (!IS_ERR(gpu_clk)) + dvfs_clk_enable_limit(gpu_clk,75*1000*1000,133*1000*1000); + //ff_scale_votlage("vdd_cpu", 1000000); //ff_scale_votlage("vdd_core", 1000000); cpu_down(1); @@ -426,6 +444,15 @@ static void ff_early_resume_func(struct early_suspend *h) char buf[32]; FF_DEBUG("enter %s\n", __func__); + if (!IS_ERR(cpu_pll)&&!IS_ERR(cpu_gpll)&&!IS_ERR(cpu_clk)) + { + clk_set_parent_force(cpu_clk,cpu_pll); + clk_set_rate(cpu_clk,300*1000*1000); + clk_enable_dvfs(cpu_clk); + } + + if (!IS_ERR(gpu_clk)) + dvfs_clk_disable_limit(gpu_clk); cpu_up(1); if (ff_read(FILE_GOV_MODE, buf) != 0) { FF_ERROR("read current governor error\n"); @@ -654,7 +681,6 @@ static int __init rk30_cpufreq_init(void) { register_pm_notifier(&rk30_cpufreq_pm_notifier); register_reboot_notifier(&rk30_cpufreq_reboot_notifier); - return cpufreq_register_driver(&rk30_cpufreq_driver); } -- 2.34.1