summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gm20b/therm_gm20b.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gm20b/therm_gm20b.c')
-rw-r--r--drivers/gpu/nvgpu/gm20b/therm_gm20b.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/therm_gm20b.c b/drivers/gpu/nvgpu/gm20b/therm_gm20b.c
new file mode 100644
index 00000000..ed1e0f49
--- /dev/null
+++ b/drivers/gpu/nvgpu/gm20b/therm_gm20b.c
@@ -0,0 +1,72 @@
1/*
2 * GM20B THERMAL
3 *
4 * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 */
15
16#include "gk20a/gk20a.h"
17#include "hw_therm_gm20b.h"
18
19static int gm20b_init_therm_setup_hw(struct gk20a *g)
20{
21 u32 v;
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(1));
31 gk20a_writel(g, therm_evt_ext_therm_1_r(),
32 therm_evt_ext_therm_1_slow_factor_f(2));
33 gk20a_writel(g, therm_evt_ext_therm_2_r(),
34 therm_evt_ext_therm_2_slow_factor_f(3));
35
36 gk20a_writel(g, therm_grad_stepping_table_r(0),
37 therm_grad_stepping_table_slowdown_factor0_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by1p5_f()) |
38 therm_grad_stepping_table_slowdown_factor1_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by2_f()) |
39 therm_grad_stepping_table_slowdown_factor2_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by4_f()) |
40 therm_grad_stepping_table_slowdown_factor3_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()) |
41 therm_grad_stepping_table_slowdown_factor4_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()));
42 gk20a_writel(g, therm_grad_stepping_table_r(1),
43 therm_grad_stepping_table_slowdown_factor0_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()) |
44 therm_grad_stepping_table_slowdown_factor1_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()) |
45 therm_grad_stepping_table_slowdown_factor2_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()) |
46 therm_grad_stepping_table_slowdown_factor3_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()) |
47 therm_grad_stepping_table_slowdown_factor4_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()));
48
49 v = gk20a_readl(g, therm_clk_timing_r(0));
50 v |= therm_clk_timing_grad_slowdown_enabled_f();
51 gk20a_writel(g, therm_clk_timing_r(0), v);
52
53 v = gk20a_readl(g, therm_config2_r());
54 v |= therm_config2_grad_enable_f(1);
55 v |= therm_config2_slowdown_factor_extended_f(1);
56 gk20a_writel(g, therm_config2_r(), v);
57
58 gk20a_writel(g, therm_grad_stepping1_r(),
59 therm_grad_stepping1_pdiv_duration_f(32));
60
61 v = gk20a_readl(g, therm_grad_stepping0_r());
62 v |= therm_grad_stepping0_feature_enable_f();
63 gk20a_writel(g, therm_grad_stepping0_r(), v);
64
65 return 0;
66}
67
68void gm20b_init_therm_ops(struct gpu_ops *gops)
69{
70 gops->therm.init_therm_setup_hw = gm20b_init_therm_setup_hw;
71
72}