summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gp106/hal_gp106.c
diff options
context:
space:
mode:
authorSunny He <suhe@nvidia.com>2017-06-29 17:24:29 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-08-02 17:43:27 -0400
commit11e29991acd25baef5b786605e136b5e71737b8e (patch)
tree1fd738a07e172ef7cdc2882359424be246964ce3 /drivers/gpu/nvgpu/gp106/hal_gp106.c
parenta15e110a9b790f55a5c6e257cfbf7f7235f5a334 (diff)
gpu: nvgpu: Reorg clk HAL initialization
Reorganize HAL initialization to remove inheritance and construct the gpu_ops struct at compile time. This patch only covers the clk and clk_arb sub-module of the gpu_ops struct. Perform HAL function assignments in hal_gxxxx.c through the population of a chip-specific copy of gpu_ops. Jira NVGPU-74 Change-Id: I553353df836b187b8eac61e16b63080b570c96b8 Signed-off-by: Sunny He <suhe@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1511076 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gp106/hal_gp106.c')
-rw-r--r--drivers/gpu/nvgpu/gp106/hal_gp106.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gp106/hal_gp106.c b/drivers/gpu/nvgpu/gp106/hal_gp106.c
index 0caf890f..38778da7 100644
--- a/drivers/gpu/nvgpu/gp106/hal_gp106.c
+++ b/drivers/gpu/nvgpu/gp106/hal_gp106.c
@@ -46,6 +46,7 @@
46 46
47#include "gp106/clk_gp106.h" 47#include "gp106/clk_gp106.h"
48#include "gp106/clk_arb_gp106.h" 48#include "gp106/clk_arb_gp106.h"
49#include "gp106/mclk_gp106.h"
49#include "gm206/bios_gm206.h" 50#include "gm206/bios_gm206.h"
50#include "gp106/therm_gp106.h" 51#include "gp106/therm_gp106.h"
51#include "gp106/xve_gp106.h" 52#include "gp106/xve_gp106.h"
@@ -72,6 +73,7 @@
72#include <nvgpu/hw/gp106/hw_top_gp106.h> 73#include <nvgpu/hw/gp106/hw_top_gp106.h>
73#include <nvgpu/hw/gp106/hw_pram_gp106.h> 74#include <nvgpu/hw/gp106/hw_pram_gp106.h>
74 75
76
75static int gp106_get_litter_value(struct gk20a *g, int value) 77static int gp106_get_litter_value(struct gk20a *g, int value)
76{ 78{
77 int ret = -EINVAL; 79 int ret = -EINVAL;
@@ -353,6 +355,21 @@ static const struct gpu_ops gp106_ops = {
353 .get_internal_sensor_limits = gp106_get_internal_sensor_limits, 355 .get_internal_sensor_limits = gp106_get_internal_sensor_limits,
354 .configure_therm_alert = gp106_configure_therm_alert, 356 .configure_therm_alert = gp106_configure_therm_alert,
355 }, 357 },
358 .clk = {
359 .init_clk_support = gp106_init_clk_support,
360 .get_crystal_clk_hz = gp106_crystal_clk_hz,
361 .measure_freq = gp106_clk_measure_freq,
362 .suspend_clk_support = gp106_suspend_clk_support,
363 .mclk_init = gp106_mclk_init,
364 .mclk_change = gp106_mclk_change,
365 .mclk_deinit = gp106_mclk_deinit,
366 },
367 .clk_arb = {
368 .get_arbiter_clk_domains = gp106_get_arbiter_clk_domains,
369 .get_arbiter_clk_range = gp106_get_arbiter_clk_range,
370 .get_arbiter_clk_default = gp106_get_arbiter_clk_default,
371 .get_current_pstate = nvgpu_clk_arb_get_current_pstate,
372 },
356 .regops = { 373 .regops = {
357 .get_global_whitelist_ranges = 374 .get_global_whitelist_ranges =
358 gp106_get_global_whitelist_ranges, 375 gp106_get_global_whitelist_ranges,
@@ -470,6 +487,19 @@ int gp106_init_hal(struct gk20a *g)
470 gops->fecs_trace = gp106_ops.fecs_trace; 487 gops->fecs_trace = gp106_ops.fecs_trace;
471 gops->pramin = gp106_ops.pramin; 488 gops->pramin = gp106_ops.pramin;
472 gops->therm = gp106_ops.therm; 489 gops->therm = gp106_ops.therm;
490 /*
491 * clk must be assigned member by member
492 * since some clk ops are assigned during probe prior to HAL init
493 */
494 gops->clk.init_clk_support = gp106_ops.clk.init_clk_support;
495 gops->clk.get_crystal_clk_hz = gp106_ops.clk.get_crystal_clk_hz;
496 gops->clk.measure_freq = gp106_ops.clk.measure_freq;
497 gops->clk.suspend_clk_support = gp106_ops.clk.suspend_clk_support;
498 gops->clk.mclk_init = gp106_ops.clk.mclk_init;
499 gops->clk.mclk_change = gp106_ops.clk.mclk_change;
500 gops->clk.mclk_deinit = gp106_ops.clk.mclk_deinit;
501
502 gops->clk_arb = gp106_ops.clk_arb;
473 gops->regops = gp106_ops.regops; 503 gops->regops = gp106_ops.regops;
474 gops->mc = gp106_ops.mc; 504 gops->mc = gp106_ops.mc;
475 gops->debug = gp106_ops.debug; 505 gops->debug = gp106_ops.debug;
@@ -499,8 +529,6 @@ int gp106_init_hal(struct gk20a *g)
499 gp106_init_fb(gops); 529 gp106_init_fb(gops);
500 gp106_init_mm(gops); 530 gp106_init_mm(gops);
501 gp106_init_pmu_ops(g); 531 gp106_init_pmu_ops(g);
502 gp106_init_clk_ops(gops);
503 gp106_init_clk_arb_ops(gops);
504 532
505 g->name = "gp10x"; 533 g->name = "gp10x";
506 534