From 66f7bcc2f841f43e9bcd2a854361d6783bdb030e Mon Sep 17 00:00:00 2001 From: Tejal Kudav Date: Tue, 21 Aug 2018 12:46:53 +0530 Subject: 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 Reviewed-on: https://git-master.nvidia.com/r/1803632 Reviewed-by: svc-misra-checker GVS: Gerrit_Virtual_Submit Reviewed-by: Vijayakumar Subbu Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/top/top_gv100.c | 66 ++++++++++++++++++++++++++++++++ drivers/gpu/nvgpu/common/top/top_gv100.h | 37 ++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 drivers/gpu/nvgpu/common/top/top_gv100.c create mode 100644 drivers/gpu/nvgpu/common/top/top_gv100.h (limited to 'drivers/gpu/nvgpu/common/top') 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 @@ +/* + * GV100 TOP UNIT + * + * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include + +#include "gk20a/gk20a.h" +#include "top_gv100.h" + +#include + +u32 gv100_top_get_nvhsclk_ctrl_e_clk_nvl(struct gk20a *g) +{ + u32 reg; + + reg = nvgpu_readl(g, top_nvhsclk_ctrl_r()); + return top_nvhsclk_ctrl_e_clk_nvl_v(reg); +} + +void gv100_top_set_nvhsclk_ctrl_e_clk_nvl(struct gk20a *g, u32 val) +{ + u32 reg; + + reg = nvgpu_readl(g, top_nvhsclk_ctrl_r()); + reg = set_field(reg, top_nvhsclk_ctrl_e_clk_nvl_m(), + top_nvhsclk_ctrl_e_clk_nvl_f(val)); + nvgpu_writel(g, top_nvhsclk_ctrl_r(), reg); +} + +u32 gv100_top_get_nvhsclk_ctrl_swap_clk_nvl(struct gk20a *g) +{ + u32 reg; + + reg = nvgpu_readl(g, top_nvhsclk_ctrl_r()); + return top_nvhsclk_ctrl_swap_clk_nvl_v(reg); +} + +void gv100_top_set_nvhsclk_ctrl_swap_clk_nvl(struct gk20a *g, u32 val) +{ + u32 reg; + + reg = nvgpu_readl(g, top_nvhsclk_ctrl_r()); + reg = set_field(reg, top_nvhsclk_ctrl_swap_clk_nvl_m(), + top_nvhsclk_ctrl_swap_clk_nvl_f(val)); + nvgpu_writel(g, top_nvhsclk_ctrl_r(), reg); +} 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 @@ +/* + * GV100 TOP UNIT + * + * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef TOP_GV100_H +#define TOP_GV100_H + +#include + +struct gk20a; + +u32 gv100_top_get_nvhsclk_ctrl_e_clk_nvl(struct gk20a *g); +void gv100_top_set_nvhsclk_ctrl_e_clk_nvl(struct gk20a *g, u32 val); +u32 gv100_top_get_nvhsclk_ctrl_swap_clk_nvl(struct gk20a *g); +void gv100_top_set_nvhsclk_ctrl_swap_clk_nvl(struct gk20a *g, u32 val); + +#endif -- cgit v1.2.2