gpu: nvgpu: ga10b: update clock operations

ga10b can have 2 GPCs and each GPC is clocked with separate
gpc clk. Added ga10b specific set_rate/get_rate operations
for gpcclks considering GPC floor-sweeping info.

Bug 3315239

Change-Id: I4e2156b4e06a1580a60d832e0d3296ed3dc17887
Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2617441
Reviewed-by: Tejal Kudav <tkudav@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: Tejal Kudav <tkudav@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Seshendra Gadagottu
2021-10-27 04:38:24 -07:00
committed by mobile promotions
parent 02ab4c3880
commit fc27aab523
5 changed files with 160 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
/*
* Linux clock support
*
* Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2017-2021, NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -29,11 +29,15 @@
#include <nvgpu/pmu/clk/clk.h>
#include "clk.h"
#include "clk_ga10b.h"
#include "os_linux.h"
#include "platform_gk20a.h"
#include <nvgpu/gk20a.h>
#include <nvgpu/clk_arb.h>
#if defined(CONFIG_NVGPU_HAL_NON_FUSA) && defined(CONFIG_NVGPU_NEXT)
#include <nvgpu_next_chips.h>
#endif
#define HZ_TO_MHZ(x) ((x) / 1000000)
@@ -292,8 +296,20 @@ static void nvgpu_linux_disable_unprepare(struct clk_gk20a *clk)
void nvgpu_linux_init_clk_support(struct gk20a *g)
{
g->ops.clk.get_rate = nvgpu_linux_clk_get_rate;
g->ops.clk.set_rate = nvgpu_linux_clk_set_rate;
struct device *dev = dev_from_gk20a(g);
struct gk20a_platform *platform = dev_get_drvdata(dev);
if ((platform->platform_chip_id == TEGRA_234)
#if defined(CONFIG_NVGPU_HAL_NON_FUSA) && defined(CONFIG_NVGPU_NEXT)
|| (platform->platform_chip_id == TEGRA_239)
#endif
){
g->ops.clk.get_rate = nvgpu_ga10b_linux_clk_get_rate;
g->ops.clk.set_rate = nvgpu_ga10b_linux_clk_set_rate;
} else {
g->ops.clk.get_rate = nvgpu_linux_clk_get_rate;
g->ops.clk.set_rate = nvgpu_linux_clk_set_rate;
}
g->ops.clk.get_fmax_at_vmin_safe = nvgpu_linux_get_fmax_at_vmin_safe;
g->ops.clk.get_ref_clock_rate = nvgpu_linux_get_ref_clock_rate;
g->ops.clk.predict_mv_at_hz_cur_tfloor = nvgpu_linux_predict_mv_at_hz_cur_tfloor;