summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/nvgpu/gv11b/hal_gv11b.c2
-rw-r--r--drivers/gpu/nvgpu/gv11b/therm_gv11b.c62
-rw-r--r--drivers/gpu/nvgpu/gv11b/therm_gv11b.h1
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/hw/gv11b/hw_therm_gv11b.h20
4 files changed, 84 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
index 65cae8de..193f6e83 100644
--- a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
+++ b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
@@ -586,7 +586,7 @@ static const struct gpu_ops gv11b_ops = {
586 .fault_info_mem_destroy = gv11b_mm_fault_info_mem_destroy, 586 .fault_info_mem_destroy = gv11b_mm_fault_info_mem_destroy,
587 }, 587 },
588 .therm = { 588 .therm = {
589 .init_therm_setup_hw = gp10b_init_therm_setup_hw, 589 .init_therm_setup_hw = gv11b_init_therm_setup_hw,
590 .elcg_init_idle_filters = gv11b_elcg_init_idle_filters, 590 .elcg_init_idle_filters = gv11b_elcg_init_idle_filters,
591 }, 591 },
592 .pmu = { 592 .pmu = {
diff --git a/drivers/gpu/nvgpu/gv11b/therm_gv11b.c b/drivers/gpu/nvgpu/gv11b/therm_gv11b.c
index 18987119..f2d929fa 100644
--- a/drivers/gpu/nvgpu/gv11b/therm_gv11b.c
+++ b/drivers/gpu/nvgpu/gv11b/therm_gv11b.c
@@ -28,6 +28,68 @@
28 28
29#include <nvgpu/hw/gv11b/hw_therm_gv11b.h> 29#include <nvgpu/hw/gv11b/hw_therm_gv11b.h>
30 30
31int gv11b_init_therm_setup_hw(struct gk20a *g)
32{
33 u32 v;
34
35 gk20a_dbg_fn("");
36
37 /* program NV_THERM registers */
38 gk20a_writel(g, therm_use_a_r(), therm_use_a_ext_therm_0_enable_f() |
39 therm_use_a_ext_therm_1_enable_f() |
40 therm_use_a_ext_therm_2_enable_f());
41 gk20a_writel(g, therm_evt_ext_therm_0_r(),
42 therm_evt_ext_therm_0_slow_factor_f(0x2));
43 gk20a_writel(g, therm_evt_ext_therm_1_r(),
44 therm_evt_ext_therm_1_slow_factor_f(0x6));
45 gk20a_writel(g, therm_evt_ext_therm_2_r(),
46 therm_evt_ext_therm_2_slow_factor_f(0xe));
47
48 gk20a_writel(g, therm_grad_stepping_table_r(0),
49 therm_grad_stepping_table_slowdown_factor0_f(
50 therm_grad_stepping_table_slowdown_factor0_fpdiv_by1_f()) |
51 therm_grad_stepping_table_slowdown_factor1_f(
52 therm_grad_stepping_table_slowdown_factor0_fpdiv_by1p5_f()) |
53 therm_grad_stepping_table_slowdown_factor2_f(
54 therm_grad_stepping_table_slowdown_factor0_fpdiv_by2_f()) |
55 therm_grad_stepping_table_slowdown_factor3_f(
56 therm_grad_stepping_table_slowdown_factor0_fpdiv_by4_f()) |
57 therm_grad_stepping_table_slowdown_factor4_f(
58 therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()));
59
60 gk20a_writel(g, therm_grad_stepping_table_r(1),
61 therm_grad_stepping_table_slowdown_factor0_f(
62 therm_grad_stepping_table_slowdown_factor0_fpdiv_by16_f()) |
63 therm_grad_stepping_table_slowdown_factor1_f(
64 therm_grad_stepping_table_slowdown_factor0_fpdiv_by32_f()) |
65 therm_grad_stepping_table_slowdown_factor2_f(
66 therm_grad_stepping_table_slowdown_factor0_fpdiv_by32_f()) |
67 therm_grad_stepping_table_slowdown_factor3_f(
68 therm_grad_stepping_table_slowdown_factor0_fpdiv_by32_f()) |
69 therm_grad_stepping_table_slowdown_factor4_f(
70 therm_grad_stepping_table_slowdown_factor0_fpdiv_by32_f()));
71
72 v = gk20a_readl(g, therm_clk_timing_r(0));
73 v |= therm_clk_timing_grad_slowdown_enabled_f();
74 gk20a_writel(g, therm_clk_timing_r(0), v);
75
76 v = gk20a_readl(g, therm_config2_r());
77 v |= therm_config2_grad_enable_f(1);
78 v |= therm_config2_slowdown_factor_extended_f(1);
79 v = set_field(v, therm_config2_grad_step_duration_m(),
80 therm_config2_grad_step_duration_f(0));
81 gk20a_writel(g, therm_config2_r(), v);
82
83 gk20a_writel(g, therm_grad_stepping1_r(),
84 therm_grad_stepping1_pdiv_duration_f(0x40));
85
86 v = gk20a_readl(g, therm_grad_stepping0_r());
87 v |= therm_grad_stepping0_feature_enable_f();
88 gk20a_writel(g, therm_grad_stepping0_r(), v);
89
90 return 0;
91}
92
31int gv11b_elcg_init_idle_filters(struct gk20a *g) 93int gv11b_elcg_init_idle_filters(struct gk20a *g)
32{ 94{
33 u32 gate_ctrl, idle_filter; 95 u32 gate_ctrl, idle_filter;
diff --git a/drivers/gpu/nvgpu/gv11b/therm_gv11b.h b/drivers/gpu/nvgpu/gv11b/therm_gv11b.h
index 1d89597b..bfe6231e 100644
--- a/drivers/gpu/nvgpu/gv11b/therm_gv11b.h
+++ b/drivers/gpu/nvgpu/gv11b/therm_gv11b.h
@@ -24,5 +24,6 @@
24 24
25struct gk20a; 25struct gk20a;
26int gv11b_elcg_init_idle_filters(struct gk20a *g); 26int gv11b_elcg_init_idle_filters(struct gk20a *g);
27int gv11b_init_therm_setup_hw(struct gk20a *g);
27 28
28#endif /* THERM_GV11B_H */ 29#endif /* THERM_GV11B_H */
diff --git a/drivers/gpu/nvgpu/include/nvgpu/hw/gv11b/hw_therm_gv11b.h b/drivers/gpu/nvgpu/include/nvgpu/hw/gv11b/hw_therm_gv11b.h
index 8f8981e8..3afe7501 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/hw/gv11b/hw_therm_gv11b.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/hw/gv11b/hw_therm_gv11b.h
@@ -180,6 +180,14 @@ static inline u32 therm_config2_r(void)
180{ 180{
181 return 0x00020130U; 181 return 0x00020130U;
182} 182}
183static inline u32 therm_config2_grad_step_duration_f(u32 v)
184{
185 return (v & 0xfU) << 8U;
186}
187static inline u32 therm_config2_grad_step_duration_m(void)
188{
189 return 0xfU << 8U;
190}
183static inline u32 therm_config2_slowdown_factor_extended_f(u32 v) 191static inline u32 therm_config2_slowdown_factor_extended_f(u32 v)
184{ 192{
185 return (v & 0x1U) << 24U; 193 return (v & 0x1U) << 24U;
@@ -336,6 +344,10 @@ static inline u32 therm_grad_stepping_table_slowdown_factor0_m(void)
336{ 344{
337 return 0x3fU << 0U; 345 return 0x3fU << 0U;
338} 346}
347static inline u32 therm_grad_stepping_table_slowdown_factor0_fpdiv_by1_f(void)
348{
349 return 0x0U;
350}
339static inline u32 therm_grad_stepping_table_slowdown_factor0_fpdiv_by1p5_f(void) 351static inline u32 therm_grad_stepping_table_slowdown_factor0_fpdiv_by1p5_f(void)
340{ 352{
341 return 0x1U; 353 return 0x1U;
@@ -352,6 +364,14 @@ static inline u32 therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f(void)
352{ 364{
353 return 0xeU; 365 return 0xeU;
354} 366}
367static inline u32 therm_grad_stepping_table_slowdown_factor0_fpdiv_by16_f(void)
368{
369 return 0x1eU;
370}
371static inline u32 therm_grad_stepping_table_slowdown_factor0_fpdiv_by32_f(void)
372{
373 return 0x3eU;
374}
355static inline u32 therm_grad_stepping_table_slowdown_factor1_f(u32 v) 375static inline u32 therm_grad_stepping_table_slowdown_factor1_f(u32 v)
356{ 376{
357 return (v & 0x3fU) << 6U; 377 return (v & 0x3fU) << 6U;