diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gm20b/therm_gm20b.c')
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/therm_gm20b.c | 78 |
1 files changed, 78 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..ce4d4fab --- /dev/null +++ b/drivers/gpu/nvgpu/gm20b/therm_gm20b.c | |||
@@ -0,0 +1,78 @@ | |||
1 | /* | ||
2 | * GM20B THERMAL | ||
3 | * | ||
4 | * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved. | ||
5 | * | ||
6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
7 | * copy of this software and associated documentation files (the "Software"), | ||
8 | * to deal in the Software without restriction, including without limitation | ||
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
10 | * and/or sell copies of the Software, and to permit persons to whom the | ||
11 | * Software is furnished to do so, subject to the following conditions: | ||
12 | * | ||
13 | * The above copyright notice and this permission notice shall be included in | ||
14 | * all copies or substantial portions of the Software. | ||
15 | * | ||
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
22 | * DEALINGS IN THE SOFTWARE. | ||
23 | */ | ||
24 | |||
25 | #include "gk20a/gk20a.h" | ||
26 | |||
27 | #include "therm_gm20b.h" | ||
28 | |||
29 | #include <nvgpu/hw/gm20b/hw_therm_gm20b.h> | ||
30 | |||
31 | int gm20b_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(therm_grad_stepping_table_slowdown_factor0_fpdiv_by1p5_f()) | | ||
50 | therm_grad_stepping_table_slowdown_factor1_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by2_f()) | | ||
51 | therm_grad_stepping_table_slowdown_factor2_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by4_f()) | | ||
52 | therm_grad_stepping_table_slowdown_factor3_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()) | | ||
53 | therm_grad_stepping_table_slowdown_factor4_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f())); | ||
54 | gk20a_writel(g, therm_grad_stepping_table_r(1), | ||
55 | therm_grad_stepping_table_slowdown_factor0_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()) | | ||
56 | therm_grad_stepping_table_slowdown_factor1_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()) | | ||
57 | therm_grad_stepping_table_slowdown_factor2_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()) | | ||
58 | therm_grad_stepping_table_slowdown_factor3_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f()) | | ||
59 | therm_grad_stepping_table_slowdown_factor4_f(therm_grad_stepping_table_slowdown_factor0_fpdiv_by8_f())); | ||
60 | |||
61 | v = gk20a_readl(g, therm_clk_timing_r(0)); | ||
62 | v |= therm_clk_timing_grad_slowdown_enabled_f(); | ||
63 | gk20a_writel(g, therm_clk_timing_r(0), v); | ||
64 | |||
65 | v = gk20a_readl(g, therm_config2_r()); | ||
66 | v |= therm_config2_grad_enable_f(1); | ||
67 | v |= therm_config2_slowdown_factor_extended_f(1); | ||
68 | gk20a_writel(g, therm_config2_r(), v); | ||
69 | |||
70 | gk20a_writel(g, therm_grad_stepping1_r(), | ||
71 | therm_grad_stepping1_pdiv_duration_f(32)); | ||
72 | |||
73 | v = gk20a_readl(g, therm_grad_stepping0_r()); | ||
74 | v |= therm_grad_stepping0_feature_enable_f(); | ||
75 | gk20a_writel(g, therm_grad_stepping0_r(), v); | ||
76 | |||
77 | return 0; | ||
78 | } | ||