gpu: fix the bug of gpu's exception after reboot
author杜坤明 <dkm@rockchip.com>
Mon, 21 Mar 2011 09:13:54 +0000 (17:13 +0800)
committer杜坤明 <dkm@rockchip.com>
Mon, 21 Mar 2011 09:13:54 +0000 (17:13 +0800)
arch/arm/mach-rk29/clock.c
drivers/staging/rk29/vivante/hal/os/linux/kernel/gc_hal_kernel_driver.c

index bb682f32a64cf1c01f4f26024cd8696b741f470d..122dc27ecf4ad7f8d0b732ca10ee0cd34df74eec 100755 (executable)
@@ -2289,7 +2289,7 @@ static int __init clk_disable_unused(void)
 
        pmu_set_power_domain(PD_VCODEC, false);
 //     pmu_set_power_domain(PD_DISPLAY, false);
-       pmu_set_power_domain(PD_GPU, false);
+//     pmu_set_power_domain(PD_GPU, false);
 
        return 0;
 }
index 5a516f3118eaa0c8364c5c488cc7f38383cfe1ca..8846dba3cfd670ddee3dcbe58b64317fc1ef4763 100755 (executable)
@@ -527,7 +527,6 @@ static int drv_init(void)
 #if ENABLE_GPU_CLOCK_BY_DRIVER && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)
     struct clk * clk_gpu = NULL;
     struct clk * clk_aclk_gpu = NULL;
-    struct clk * clk_hclk_gpu = NULL;
 #endif
 
     gcmkTRACE_ZONE(gcvLEVEL_VERBOSE, gcvZONE_DRIVER,
@@ -535,12 +534,7 @@ static int drv_init(void)
 
 #if ENABLE_GPU_CLOCK_BY_DRIVER && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)
 
-    printk("%s : gpu clk_enable... ", __func__);
-    // clk_gpu_ahb
-    clk_hclk_gpu = clk_get(NULL, "hclk_gpu");
-    if(!IS_ERR(clk_hclk_gpu))    clk_enable(clk_hclk_gpu);
-
-    // clk_aclk_gpu
+    // set clk_aclk_gpu rate but no enable
     clk_aclk_gpu = clk_get(NULL, "aclk_gpu");
     if (IS_ERR(clk_aclk_gpu))
     {
@@ -554,11 +548,8 @@ static int drv_init(void)
                      "[galcore] Can't set aclk_gpu clock.");
         return -EAGAIN;
     }
-    clk_enable(clk_aclk_gpu);    
-
-    clk_enable(clk_get(NULL, "aclk_ddr_gpu"));
 
-    // clk_gpu
+    // set clk_gpu rate but no enable
     clk_gpu = clk_get(NULL, "gpu");
     if (IS_ERR(clk_gpu))
     {
@@ -566,7 +557,6 @@ static int drv_init(void)
         printk("clk_gpu get error: %d\n", retval);
         return -ENODEV;
     }
-
     clk_set_rate(clk_get(NULL, "codec_pll"), coreClock);
     /* APMU_GC_156M, APMU_GC_624M, APMU_GC_PLL2, APMU_GC_PLL2_DIV2 currently */
     if (clk_set_rate(clk_gpu, coreClock))  //designed on 500M
@@ -575,31 +565,9 @@ static int drv_init(void)
                      "[galcore] Can't set core clock.");
         return -EAGAIN;
     }
-    clk_enable(clk_gpu);
-    printk("done!\n");
-
+    
     // enable ram clock gate
     writel(readl(RK29_GRF_BASE+0xc0) & ~0x100000, RK29_GRF_BASE+0xc0);
-    
-#if 0
-    // power on gpu
-    printk("%s : gpu power on... ", __func__);
-    clk_disable(clk_get(NULL, "aclk_ddr_gpu"));
-    udelay(10);
-    pmu_set_power_domain(PD_GPU, true);
-    udelay(10);
-    clk_enable(clk_get(NULL, "aclk_ddr_gpu"));
-    printk("done!\n");
-#endif
-
-    printk("%s : gpu clk_disable...  ", __func__);
-    mdelay(1);
-    clk_disable(clk_gpu);
-    clk_disable(clk_aclk_gpu);
-    clk_disable(clk_get(NULL, "aclk_ddr_gpu"));
-    clk_disable(clk_hclk_gpu);
-    mdelay(1);
-    printk("done!\n");
 
 #endif
 
@@ -743,11 +711,6 @@ static void drv_exit(void)
 
 #if ENABLE_GPU_CLOCK_BY_DRIVER && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)
 
-    printk("%s : gpu power off... ", __func__);
-    pmu_set_power_domain(PD_GPU, false);
-    printk("done!\n");
-    msleep(10);
-    
     printk("%s : gpu clk_disable... ", __func__);
     clk_hclk_gpu = clk_get(NULL, "hclk_gpu");
     if(!IS_ERR(clk_hclk_gpu))    clk_disable(clk_hclk_gpu);
@@ -762,6 +725,15 @@ static void drv_exit(void)
     printk("done!\n");
     msleep(10);
 
+    printk("%s : gpu power off... ", __func__);
+    pmu_set_power_domain(PD_GPU, false);
+    printk("done!\n");
+    msleep(10);
+
+    // disable ram clock gate
+    writel(readl(RK29_GRF_BASE+0xc0) | 0x100000, RK29_GRF_BASE+0xc0);
+    msleep(10);
+
 #endif
 }