gpll support 300M
authorxxx <xxx@rock-chips.com>
Tue, 26 Jun 2012 06:14:07 +0000 (23:14 -0700)
committerxxx <xxx@rock-chips.com>
Tue, 26 Jun 2012 06:14:07 +0000 (23:14 -0700)
arch/arm/mach-rk30/clock.c [changed mode: 0644->0755]
arch/arm/mach-rk30/clock_data.c
arch/arm/mach-rk30/cpufreq.c

old mode 100644 (file)
new mode 100755 (executable)
index e0afe5b..264642e
@@ -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);
index 98306de6ec2105fef1397b3d7458391b4f95c4d0..1f24fcb58309ca84509485bd12d3c5bcdabc2bc0 100644 (file)
@@ -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);
index 007867f2afb8fb9f0d28f13bbc831470fdd618e0..90bf09643aade8bef0211ddbd738c886841794ea 100755 (executable)
@@ -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);
 }