summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeshendra Gadagottu <sgadagottu@nvidia.com>2015-10-22 18:31:43 -0400
committerDeepak Nibade <dnibade@nvidia.com>2016-12-27 04:52:09 -0500
commit313fcdb1d3c12026246df01c81e2ecd212132de8 (patch)
tree8e55a6c8777688275d067cb5110c518b1e897ad8
parent35e3018be12b56ecfa8487ba479cb2df38c6fbf3 (diff)
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 <sgadagottu@nvidia.com> Reviewed-on: http://git-master/r/823013 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/gp10b/Makefile3
-rw-r--r--drivers/gpu/nvgpu/gp10b/hal_gp10b.c2
-rw-r--r--drivers/gpu/nvgpu/gp10b/hw_therm_gp10b.h98
-rw-r--r--drivers/gpu/nvgpu/gp10b/therm_gp10b.c46
-rw-r--r--drivers/gpu/nvgpu/gp10b/therm_gp10b.h19
5 files changed, 166 insertions, 2 deletions
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) += \
23 rpfb_gp10b.o \ 23 rpfb_gp10b.o \
24 gp10b_gating_reglist.o \ 24 gp10b_gating_reglist.o \
25 regops_gp10b.o \ 25 regops_gp10b.o \
26 cde_gp10b.o 26 cde_gp10b.o \
27 therm_gp10b.o
27 28
28obj-$(CONFIG_TEGRA_GK20A) += platform_gp10b_tegra.o 29obj-$(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 @@
32#include "gp10b/gp10b_gating_reglist.h" 32#include "gp10b/gp10b_gating_reglist.h"
33#include "gp10b/regops_gp10b.h" 33#include "gp10b/regops_gp10b.h"
34#include "gp10b/cde_gp10b.h" 34#include "gp10b/cde_gp10b.h"
35#include "gp10b/therm_gp10b.h"
35 36
36#include "gm20b/gr_gm20b.h" 37#include "gm20b/gr_gm20b.h"
37#include "gm20b/fifo_gm20b.h" 38#include "gm20b/fifo_gm20b.h"
@@ -144,6 +145,7 @@ int gp10b_init_hal(struct gk20a *g)
144 gk20a_init_debug_ops(gops); 145 gk20a_init_debug_ops(gops);
145 gp10b_init_regops(gops); 146 gp10b_init_regops(gops);
146 gp10b_init_cde_ops(gops); 147 gp10b_init_cde_ops(gops);
148 gp10b_init_therm_ops(gops);
147 gops->name = "gp10b"; 149 gops->name = "gp10b";
148 150
149 c->twod_class = FERMI_TWOD_A; 151 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 @@
1/* 1/*
2 * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -54,18 +54,114 @@ static inline u32 therm_use_a_r(void)
54{ 54{
55 return 0x00020798; 55 return 0x00020798;
56} 56}
57static inline u32 therm_use_a_ext_therm_0_enable_f(void)
58{
59 return 0x1;
60}
61static inline u32 therm_use_a_ext_therm_1_enable_f(void)
62{
63 return 0x2;
64}
65static inline u32 therm_use_a_ext_therm_2_enable_f(void)
66{
67 return 0x4;
68}
57static inline u32 therm_evt_ext_therm_0_r(void) 69static inline u32 therm_evt_ext_therm_0_r(void)
58{ 70{
59 return 0x00020700; 71 return 0x00020700;
60} 72}
73static inline u32 therm_evt_ext_therm_0_slow_factor_f(u32 v)
74{
75 return (v & 0x3f) << 24;
76}
77static inline u32 therm_evt_ext_therm_0_slow_factor_init_v(void)
78{
79 return 0x00000001;
80}
81static inline u32 therm_evt_ext_therm_0_mode_f(u32 v)
82{
83 return (v & 0x3) << 30;
84}
85static inline u32 therm_evt_ext_therm_0_mode_normal_v(void)
86{
87 return 0x00000000;
88}
89static inline u32 therm_evt_ext_therm_0_mode_inverted_v(void)
90{
91 return 0x00000001;
92}
93static inline u32 therm_evt_ext_therm_0_mode_forced_v(void)
94{
95 return 0x00000002;
96}
97static inline u32 therm_evt_ext_therm_0_mode_cleared_v(void)
98{
99 return 0x00000003;
100}
61static inline u32 therm_evt_ext_therm_1_r(void) 101static inline u32 therm_evt_ext_therm_1_r(void)
62{ 102{
63 return 0x00020704; 103 return 0x00020704;
64} 104}
105static inline u32 therm_evt_ext_therm_1_slow_factor_f(u32 v)
106{
107 return (v & 0x3f) << 24;
108}
109static inline u32 therm_evt_ext_therm_1_slow_factor_init_v(void)
110{
111 return 0x00000002;
112}
113static inline u32 therm_evt_ext_therm_1_mode_f(u32 v)
114{
115 return (v & 0x3) << 30;
116}
117static inline u32 therm_evt_ext_therm_1_mode_normal_v(void)
118{
119 return 0x00000000;
120}
121static inline u32 therm_evt_ext_therm_1_mode_inverted_v(void)
122{
123 return 0x00000001;
124}
125static inline u32 therm_evt_ext_therm_1_mode_forced_v(void)
126{
127 return 0x00000002;
128}
129static inline u32 therm_evt_ext_therm_1_mode_cleared_v(void)
130{
131 return 0x00000003;
132}
65static inline u32 therm_evt_ext_therm_2_r(void) 133static inline u32 therm_evt_ext_therm_2_r(void)
66{ 134{
67 return 0x00020708; 135 return 0x00020708;
68} 136}
137static inline u32 therm_evt_ext_therm_2_slow_factor_f(u32 v)
138{
139 return (v & 0x3f) << 24;
140}
141static inline u32 therm_evt_ext_therm_2_slow_factor_init_v(void)
142{
143 return 0x00000003;
144}
145static inline u32 therm_evt_ext_therm_2_mode_f(u32 v)
146{
147 return (v & 0x3) << 30;
148}
149static inline u32 therm_evt_ext_therm_2_mode_normal_v(void)
150{
151 return 0x00000000;
152}
153static inline u32 therm_evt_ext_therm_2_mode_inverted_v(void)
154{
155 return 0x00000001;
156}
157static inline u32 therm_evt_ext_therm_2_mode_forced_v(void)
158{
159 return 0x00000002;
160}
161static inline u32 therm_evt_ext_therm_2_mode_cleared_v(void)
162{
163 return 0x00000003;
164}
69static inline u32 therm_weight_1_r(void) 165static inline u32 therm_weight_1_r(void)
70{ 166{
71 return 0x00020024; 167 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 @@
1/*
2 * drivers/gpu/nvgpu/gm20b/therm_gk20a.c
3 *
4 * GP10B Therm
5 *
6 * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License,
10 * version 2, as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 */
17
18#include "gk20a/gk20a.h"
19#include "hw_therm_gp10b.h"
20
21static int gp10b_init_therm_setup_hw(struct gk20a *g)
22{
23 gk20a_dbg_fn("");
24
25 /* program NV_THERM registers */
26 gk20a_writel(g, therm_use_a_r(), therm_use_a_ext_therm_0_enable_f() |
27 therm_use_a_ext_therm_1_enable_f() |
28 therm_use_a_ext_therm_2_enable_f());
29 gk20a_writel(g, therm_evt_ext_therm_0_r(),
30 therm_evt_ext_therm_0_slow_factor_f(
31 therm_evt_ext_therm_0_slow_factor_init_v()));
32 gk20a_writel(g, therm_evt_ext_therm_1_r(),
33 therm_evt_ext_therm_1_slow_factor_f(
34 therm_evt_ext_therm_1_slow_factor_init_v()));
35 gk20a_writel(g, therm_evt_ext_therm_2_r(),
36 therm_evt_ext_therm_2_slow_factor_f(
37 therm_evt_ext_therm_2_slow_factor_init_v()));
38
39 return 0;
40}
41
42void gp10b_init_therm_ops(struct gpu_ops *gops)
43{
44 gops->therm.init_therm_setup_hw = gp10b_init_therm_setup_hw;
45
46}
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 @@
1/*
2 * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 */
13#ifndef THERM_GP10B_H
14#define THERM_GP10B_H
15
16struct gpu_ops;
17void gp10b_init_therm_ops(struct gpu_ops *gops);
18
19#endif /* THERM_GP10B_H */