diff options
author | Tejal Kudav <tkudav@nvidia.com> | 2018-08-21 03:16:53 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-09-10 07:54:00 -0400 |
commit | 66f7bcc2f841f43e9bcd2a854361d6783bdb030e (patch) | |
tree | fd7ac3e76e45caf9d3a6b2082139a89c51c6d88a /drivers/gpu/nvgpu/common | |
parent | b026c012963b135f8689c4409d12e79a76bb1156 (diff) |
gpu: nvgpu: Add Top as a unit
NVHSCLK registers used by NVLINK IP are part of dev_top
hardware headers. This patch adds "Top" as a separate
unit and exposes HALs to access dev_top registers. The top
unit contains top-level configuration information and any
extra registers or features that do not fit into another block's
feature set.
JIRA NVGPU-1053
JIRA NVGPU-966
Change-Id: Id9a43d4a1c5397959897a242ea97a39a1b95f916
Signed-off-by: Tejal Kudav <tkudav@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1803632
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common')
-rw-r--r-- | drivers/gpu/nvgpu/common/top/top_gv100.c | 66 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/top/top_gv100.h | 37 |
2 files changed, 103 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/top/top_gv100.c b/drivers/gpu/nvgpu/common/top/top_gv100.c new file mode 100644 index 00000000..138528a2 --- /dev/null +++ b/drivers/gpu/nvgpu/common/top/top_gv100.c | |||
@@ -0,0 +1,66 @@ | |||
1 | /* | ||
2 | * GV100 TOP UNIT | ||
3 | * | ||
4 | * Copyright (c) 2018, 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 <nvgpu/io.h> | ||
26 | |||
27 | #include "gk20a/gk20a.h" | ||
28 | #include "top_gv100.h" | ||
29 | |||
30 | #include <nvgpu/hw/gv100/hw_top_gv100.h> | ||
31 | |||
32 | u32 gv100_top_get_nvhsclk_ctrl_e_clk_nvl(struct gk20a *g) | ||
33 | { | ||
34 | u32 reg; | ||
35 | |||
36 | reg = nvgpu_readl(g, top_nvhsclk_ctrl_r()); | ||
37 | return top_nvhsclk_ctrl_e_clk_nvl_v(reg); | ||
38 | } | ||
39 | |||
40 | void gv100_top_set_nvhsclk_ctrl_e_clk_nvl(struct gk20a *g, u32 val) | ||
41 | { | ||
42 | u32 reg; | ||
43 | |||
44 | reg = nvgpu_readl(g, top_nvhsclk_ctrl_r()); | ||
45 | reg = set_field(reg, top_nvhsclk_ctrl_e_clk_nvl_m(), | ||
46 | top_nvhsclk_ctrl_e_clk_nvl_f(val)); | ||
47 | nvgpu_writel(g, top_nvhsclk_ctrl_r(), reg); | ||
48 | } | ||
49 | |||
50 | u32 gv100_top_get_nvhsclk_ctrl_swap_clk_nvl(struct gk20a *g) | ||
51 | { | ||
52 | u32 reg; | ||
53 | |||
54 | reg = nvgpu_readl(g, top_nvhsclk_ctrl_r()); | ||
55 | return top_nvhsclk_ctrl_swap_clk_nvl_v(reg); | ||
56 | } | ||
57 | |||
58 | void gv100_top_set_nvhsclk_ctrl_swap_clk_nvl(struct gk20a *g, u32 val) | ||
59 | { | ||
60 | u32 reg; | ||
61 | |||
62 | reg = nvgpu_readl(g, top_nvhsclk_ctrl_r()); | ||
63 | reg = set_field(reg, top_nvhsclk_ctrl_swap_clk_nvl_m(), | ||
64 | top_nvhsclk_ctrl_swap_clk_nvl_f(val)); | ||
65 | nvgpu_writel(g, top_nvhsclk_ctrl_r(), reg); | ||
66 | } | ||
diff --git a/drivers/gpu/nvgpu/common/top/top_gv100.h b/drivers/gpu/nvgpu/common/top/top_gv100.h new file mode 100644 index 00000000..885b7814 --- /dev/null +++ b/drivers/gpu/nvgpu/common/top/top_gv100.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * GV100 TOP UNIT | ||
3 | * | ||
4 | * Copyright (c) 2018, 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 | #ifndef TOP_GV100_H | ||
26 | #define TOP_GV100_H | ||
27 | |||
28 | #include <nvgpu/types.h> | ||
29 | |||
30 | struct gk20a; | ||
31 | |||
32 | u32 gv100_top_get_nvhsclk_ctrl_e_clk_nvl(struct gk20a *g); | ||
33 | void gv100_top_set_nvhsclk_ctrl_e_clk_nvl(struct gk20a *g, u32 val); | ||
34 | u32 gv100_top_get_nvhsclk_ctrl_swap_clk_nvl(struct gk20a *g); | ||
35 | void gv100_top_set_nvhsclk_ctrl_swap_clk_nvl(struct gk20a *g, u32 val); | ||
36 | |||
37 | #endif | ||