From 3a032c33fb70453494e0b143a93db61f859381ea Mon Sep 17 00:00:00 2001 From: Shardar Shariff Md Date: Tue, 1 Nov 2016 19:09:46 +0530 Subject: gpu: nvgpu: gp10b: define fuse macro depend on kernel version - Define fuse macros depending on kernel version as fuse offset got changed in K4.4 and for K4.4 fuse defines are defined in common header file (tegra-fuse.h) - Use fuse control read/write APIs when reading control registers for K4.4 Bug 200243956 Change-Id: I34dabd1a307d10010cb89ac6a5f1e3f5b177c0fc Signed-off-by: Shardar Shariff Md Reviewed-on: http://git-master/r/1245825 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/gp10b/gp10b_sysfs.h | 4 ++++ drivers/gpu/nvgpu/gp10b/gr_gp10b.c | 6 ++++++ drivers/gpu/nvgpu/gp10b/hal_gp10b.c | 3 +++ 3 files changed, 13 insertions(+) (limited to 'drivers/gpu') diff --git a/drivers/gpu/nvgpu/gp10b/gp10b_sysfs.h b/drivers/gpu/nvgpu/gp10b/gp10b_sysfs.h index 7c3d3400..786a3bb0 100644 --- a/drivers/gpu/nvgpu/gp10b/gp10b_sysfs.h +++ b/drivers/gpu/nvgpu/gp10b/gp10b_sysfs.h @@ -16,8 +16,12 @@ #ifndef _GP10B_SYSFS_H_ #define _GP10B_SYSFS_H_ +#include + /*ECC Fuse*/ +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) #define FUSE_OPT_ECC_EN 0x358 +#endif void gp10b_create_sysfs(struct device *dev); void gp10b_remove_sysfs(struct device *dev); diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c index 0705d8b6..09c2558c 100644 --- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -1533,8 +1534,13 @@ static void gr_gp10b_init_cyclestats(struct gk20a *g) static void gr_gp10b_set_gpc_tpc_mask(struct gk20a *g, u32 gpc_index) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) tegra_fuse_writel(0x1, FUSE_FUSEBYPASS_0); tegra_fuse_writel(0x0, FUSE_WRITE_ACCESS_SW_0); +#else + tegra_fuse_control_write(0x1, FUSE_FUSEBYPASS_0); + tegra_fuse_control_write(0x0, FUSE_WRITE_ACCESS_SW_0); +#endif if (g->gr.gpc_tpc_mask[gpc_index] == 0x1) tegra_fuse_writel(0x2, FUSE_OPT_GPU_TPC0_DISABLE_0); diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c index 2699dd7a..f0137a70 100644 --- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c @@ -15,6 +15,7 @@ #include #include +#include #include @@ -46,7 +47,9 @@ #include "gk20a/dbg_gpu_gk20a.h" #include "gk20a/css_gr_gk20a.h" +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) #define FUSE_OPT_PRIV_SEC_EN_0 0x264 +#endif #define PRIV_SECURITY_ENABLED 0x01 static struct gpu_ops gp10b_ops = { -- cgit v1.2.2