From 889799d2411853a387912f2b8a26b0efe4a53771 Mon Sep 17 00:00:00 2001 From: Shawn Guo Date: Mon, 29 Jul 2013 13:59:11 +0800 Subject: [PATCH] ENGR00240988: gpu: use reset API on 3.10 kernel Use reset API to reset GPU on 3.10 kernel. Signed-off-by: Shawn Guo --- .../hal/os/linux/kernel/gc_hal_kernel_device.h | 1 + .../hal/os/linux/kernel/gc_hal_kernel_driver.c | 13 +++++++++++++ .../gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c | 5 +++++ 3 files changed, 19 insertions(+) diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.h b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.h index 6e71e00509dd..0347a81d7623 100644 --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.h +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.h @@ -108,6 +108,7 @@ typedef struct _gckGALDEVICE struct device *pmdev; #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) struct contiguous_mem_pool *pool; + struct reset_control *rstc[gcdMAX_GPU_COUNT]; #endif } * gckGALDEVICE; diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c index e7cdb71bc687..83118002db5a 100644 --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c @@ -71,6 +71,8 @@ task_notify_func(struct notifier_block *self, unsigned long val, void *data) #include #if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) #include +#else +#include #endif #endif /* Zone used for header/footer. */ @@ -1048,6 +1050,7 @@ static int __devinit gpu_probe(struct platform_device *pdev) struct resource* res; #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) struct contiguous_mem_pool *pool; + struct reset_control *rstc; #elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) struct device_node *dn =pdev->dev.of_node; const u32 *prop; @@ -1126,6 +1129,16 @@ static int __devinit gpu_probe(struct platform_device *pdev) if (!ret) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) + rstc = devm_reset_control_get(&pdev->dev, "gpu3d"); + galDevice->rstc[gcvCORE_MAJOR] = IS_ERR(rstc) ? NULL : rstc; + + rstc = devm_reset_control_get(&pdev->dev, "gpu2d"); + galDevice->rstc[gcvCORE_2D] = IS_ERR(rstc) ? NULL : rstc; + + rstc = devm_reset_control_get(&pdev->dev, "gpuvg"); + galDevice->rstc[gcvCORE_VG] = IS_ERR(rstc) ? NULL : rstc; +#endif platform_set_drvdata(pdev, galDevice); #if gcdENABLE_FSCALE_VAL_ADJUST diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c index f21651660395..5366c08ef47a 100644 --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c @@ -39,6 +39,7 @@ #include #endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) +#include static inline void imx_gpc_power_up_pu(bool flag) {} #elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) #include @@ -7059,6 +7060,10 @@ gckOS_ResetGPU( } gcmkFOOTER_NO(); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) + struct reset_control *rstc = Os->device->rstc[Core]; + if (rstc) + reset_control_reset(rstc); #else imx_src_reset_gpu((int)Core); #endif -- 2.39.5