From 6c854638f5d33146ba84728ec63125087deb6439 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E6=9D=9C=E5=9D=A4=E6=98=8E?= Date: Mon, 21 Mar 2011 17:13:54 +0800 Subject: [PATCH] gpu: fix the bug of gpu's exception after reboot --- arch/arm/mach-rk29/clock.c | 2 +- .../os/linux/kernel/gc_hal_kernel_driver.c | 52 +++++-------------- 2 files changed, 13 insertions(+), 41 deletions(-) diff --git a/arch/arm/mach-rk29/clock.c b/arch/arm/mach-rk29/clock.c index bb682f32a64c..122dc27ecf4a 100755 --- a/arch/arm/mach-rk29/clock.c +++ b/arch/arm/mach-rk29/clock.c @@ -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; } diff --git a/drivers/staging/rk29/vivante/hal/os/linux/kernel/gc_hal_kernel_driver.c b/drivers/staging/rk29/vivante/hal/os/linux/kernel/gc_hal_kernel_driver.c index 5a516f3118ea..8846dba3cfd6 100755 --- a/drivers/staging/rk29/vivante/hal/os/linux/kernel/gc_hal_kernel_driver.c +++ b/drivers/staging/rk29/vivante/hal/os/linux/kernel/gc_hal_kernel_driver.c @@ -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 } -- 2.34.1