From 313fcdb1d3c12026246df01c81e2ecd212132de8 Mon Sep 17 00:00:00 2001 From: Seshendra Gadagottu Date: Thu, 22 Oct 2015 15:31:43 -0700 Subject: gpu: nvgpu: gp10b: update thermal programming Add required fileds and values for thermal slow-down settings in thermal header file and corrected thermal register programming with correct values. Bug 1695567 Reviewed-on: http://git-master/r/822200 (cherry picked from commit 859d1bda6a059b321d859c887fab8d51d2caa981) Change-Id: Id90ebd46bc3d6e4284a91e7f2b775d78502a3eca Signed-off-by: Seshendra Gadagottu Reviewed-on: http://git-master/r/823013 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gp10b/Makefile | 3 +- drivers/gpu/nvgpu/gp10b/hal_gp10b.c | 2 + drivers/gpu/nvgpu/gp10b/hw_therm_gp10b.h | 98 +++++++++++++++++++++++++++++++- drivers/gpu/nvgpu/gp10b/therm_gp10b.c | 46 +++++++++++++++ drivers/gpu/nvgpu/gp10b/therm_gp10b.h | 19 +++++++ 5 files changed, 166 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/nvgpu/gp10b/therm_gp10b.c create mode 100644 drivers/gpu/nvgpu/gp10b/therm_gp10b.h (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/gp10b/Makefile b/drivers/gpu/nvgpu/gp10b/Makefile index ad198327..f34d836d 100644 --- a/drivers/gpu/nvgpu/gp10b/Makefile +++ b/drivers/gpu/nvgpu/gp10b/Makefile @@ -23,6 +23,7 @@ obj-$(CONFIG_GK20A) += \ rpfb_gp10b.o \ gp10b_gating_reglist.o \ regops_gp10b.o \ - cde_gp10b.o + cde_gp10b.o \ + therm_gp10b.o obj-$(CONFIG_TEGRA_GK20A) += platform_gp10b_tegra.o diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c index 5222fca6..544be96b 100644 --- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c @@ -32,6 +32,7 @@ #include "gp10b/gp10b_gating_reglist.h" #include "gp10b/regops_gp10b.h" #include "gp10b/cde_gp10b.h" +#include "gp10b/therm_gp10b.h" #include "gm20b/gr_gm20b.h" #include "gm20b/fifo_gm20b.h" @@ -144,6 +145,7 @@ int gp10b_init_hal(struct gk20a *g) gk20a_init_debug_ops(gops); gp10b_init_regops(gops); gp10b_init_cde_ops(gops); + gp10b_init_therm_ops(gops); gops->name = "gp10b"; c->twod_class = FERMI_TWOD_A; diff --git a/drivers/gpu/nvgpu/gp10b/hw_therm_gp10b.h b/drivers/gpu/nvgpu/gp10b/hw_therm_gp10b.h index 25eecb70..aed75481 100644 --- a/drivers/gpu/nvgpu/gp10b/hw_therm_gp10b.h +++ b/drivers/gpu/nvgpu/gp10b/hw_therm_gp10b.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -54,18 +54,114 @@ static inline u32 therm_use_a_r(void) { return 0x00020798; } +static inline u32 therm_use_a_ext_therm_0_enable_f(void) +{ + return 0x1; +} +static inline u32 therm_use_a_ext_therm_1_enable_f(void) +{ + return 0x2; +} +static inline u32 therm_use_a_ext_therm_2_enable_f(void) +{ + return 0x4; +} static inline u32 therm_evt_ext_therm_0_r(void) { return 0x00020700; } +static inline u32 therm_evt_ext_therm_0_slow_factor_f(u32 v) +{ + return (v & 0x3f) << 24; +} +static inline u32 therm_evt_ext_therm_0_slow_factor_init_v(void) +{ + return 0x00000001; +} +static inline u32 therm_evt_ext_therm_0_mode_f(u32 v) +{ + return (v & 0x3) << 30; +} +static inline u32 therm_evt_ext_therm_0_mode_normal_v(void) +{ + return 0x00000000; +} +static inline u32 therm_evt_ext_therm_0_mode_inverted_v(void) +{ + return 0x00000001; +} +static inline u32 therm_evt_ext_therm_0_mode_forced_v(void) +{ + return 0x00000002; +} +static inline u32 therm_evt_ext_therm_0_mode_cleared_v(void) +{ + return 0x00000003; +} static inline u32 therm_evt_ext_therm_1_r(void) { return 0x00020704; } +static inline u32 therm_evt_ext_therm_1_slow_factor_f(u32 v) +{ + return (v & 0x3f) << 24; +} +static inline u32 therm_evt_ext_therm_1_slow_factor_init_v(void) +{ + return 0x00000002; +} +static inline u32 therm_evt_ext_therm_1_mode_f(u32 v) +{ + return (v & 0x3) << 30; +} +static inline u32 therm_evt_ext_therm_1_mode_normal_v(void) +{ + return 0x00000000; +} +static inline u32 therm_evt_ext_therm_1_mode_inverted_v(void) +{ + return 0x00000001; +} +static inline u32 therm_evt_ext_therm_1_mode_forced_v(void) +{ + return 0x00000002; +} +static inline u32 therm_evt_ext_therm_1_mode_cleared_v(void) +{ + return 0x00000003; +} static inline u32 therm_evt_ext_therm_2_r(void) { return 0x00020708; } +static inline u32 therm_evt_ext_therm_2_slow_factor_f(u32 v) +{ + return (v & 0x3f) << 24; +} +static inline u32 therm_evt_ext_therm_2_slow_factor_init_v(void) +{ + return 0x00000003; +} +static inline u32 therm_evt_ext_therm_2_mode_f(u32 v) +{ + return (v & 0x3) << 30; +} +static inline u32 therm_evt_ext_therm_2_mode_normal_v(void) +{ + return 0x00000000; +} +static inline u32 therm_evt_ext_therm_2_mode_inverted_v(void) +{ + return 0x00000001; +} +static inline u32 therm_evt_ext_therm_2_mode_forced_v(void) +{ + return 0x00000002; +} +static inline u32 therm_evt_ext_therm_2_mode_cleared_v(void) +{ + return 0x00000003; +} static inline u32 therm_weight_1_r(void) { return 0x00020024; diff --git a/drivers/gpu/nvgpu/gp10b/therm_gp10b.c b/drivers/gpu/nvgpu/gp10b/therm_gp10b.c new file mode 100644 index 00000000..471edb87 --- /dev/null +++ b/drivers/gpu/nvgpu/gp10b/therm_gp10b.c @@ -0,0 +1,46 @@ +/* + * drivers/gpu/nvgpu/gm20b/therm_gk20a.c + * + * GP10B Therm + * + * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#include "gk20a/gk20a.h" +#include "hw_therm_gp10b.h" + +static int gp10b_init_therm_setup_hw(struct gk20a *g) +{ + gk20a_dbg_fn(""); + + /* program NV_THERM registers */ + gk20a_writel(g, therm_use_a_r(), therm_use_a_ext_therm_0_enable_f() | + therm_use_a_ext_therm_1_enable_f() | + therm_use_a_ext_therm_2_enable_f()); + gk20a_writel(g, therm_evt_ext_therm_0_r(), + therm_evt_ext_therm_0_slow_factor_f( + therm_evt_ext_therm_0_slow_factor_init_v())); + gk20a_writel(g, therm_evt_ext_therm_1_r(), + therm_evt_ext_therm_1_slow_factor_f( + therm_evt_ext_therm_1_slow_factor_init_v())); + gk20a_writel(g, therm_evt_ext_therm_2_r(), + therm_evt_ext_therm_2_slow_factor_f( + therm_evt_ext_therm_2_slow_factor_init_v())); + + return 0; +} + +void gp10b_init_therm_ops(struct gpu_ops *gops) +{ + gops->therm.init_therm_setup_hw = gp10b_init_therm_setup_hw; + +} diff --git a/drivers/gpu/nvgpu/gp10b/therm_gp10b.h b/drivers/gpu/nvgpu/gp10b/therm_gp10b.h new file mode 100644 index 00000000..18c102fe --- /dev/null +++ b/drivers/gpu/nvgpu/gp10b/therm_gp10b.h @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ +#ifndef THERM_GP10B_H +#define THERM_GP10B_H + +struct gpu_ops; +void gp10b_init_therm_ops(struct gpu_ops *gops); + +#endif /* THERM_GP10B_H */ -- cgit v1.2.2