diff options
author | Vaikundanathan S <vaikuns@nvidia.com> | 2018-02-19 02:25:39 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-04-12 05:31:11 -0400 |
commit | 1f4bbff6e068e4b718b69bea5b9a1c3c07f5c49a (patch) | |
tree | 8fe2ab3164b897acbabbf527c37a67f11e397612 /drivers/gpu/nvgpu/clk/clk_domain.c | |
parent | 38930ee2442963f83284afe45e3f262408d92159 (diff) |
gpu: nvgpu: Port clkdomain & clkprog from chips_a
Update clk_domain_3x_prog,
Add vbios hal entry for GV100
Add stubbing in place of boardobj_interfaces.
Change-Id: Id880f303f40a07a6bf2a7f4f21d612124e89fe03
Signed-off-by: Vaikundanathan S <vaikuns@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1660697
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Tested-by: Mahantesh Kumbar <mkumbar@nvidia.com>
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/clk/clk_domain.c')
-rw-r--r-- | drivers/gpu/nvgpu/clk/clk_domain.c | 60 |
1 files changed, 52 insertions, 8 deletions
diff --git a/drivers/gpu/nvgpu/clk/clk_domain.c b/drivers/gpu/nvgpu/clk/clk_domain.c index dbbf4d4a..1d47d2d5 100644 --- a/drivers/gpu/nvgpu/clk/clk_domain.c +++ b/drivers/gpu/nvgpu/clk/clk_domain.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * Permission is hereby granted, free of charge, to any person obtaining a | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
5 | * copy of this software and associated documentation files (the "Software"), | 5 | * copy of this software and associated documentation files (the "Software"), |
@@ -39,8 +39,8 @@ static u32 devinit_get_clocks_table(struct gk20a *g, | |||
39 | static u32 clk_domain_pmudatainit_super(struct gk20a *g, struct boardobj | 39 | static u32 clk_domain_pmudatainit_super(struct gk20a *g, struct boardobj |
40 | *board_obj_ptr, struct nv_pmu_boardobj *ppmudata); | 40 | *board_obj_ptr, struct nv_pmu_boardobj *ppmudata); |
41 | 41 | ||
42 | static const struct vbios_clocks_table_1x_hal_clock_entry | 42 | static struct vbios_clocks_table_1x_hal_clock_entry |
43 | vbiosclktbl1xhalentry[] = { | 43 | vbiosclktbl1xhalentry_gp[] = { |
44 | { clkwhich_gpc2clk, true, }, | 44 | { clkwhich_gpc2clk, true, }, |
45 | { clkwhich_xbar2clk, true, }, | 45 | { clkwhich_xbar2clk, true, }, |
46 | { clkwhich_mclk, false, }, | 46 | { clkwhich_mclk, false, }, |
@@ -51,11 +51,39 @@ static const struct vbios_clocks_table_1x_hal_clock_entry | |||
51 | { clkwhich_dispclk, false, }, | 51 | { clkwhich_dispclk, false, }, |
52 | { clkwhich_pciegenclk, false, } | 52 | { clkwhich_pciegenclk, false, } |
53 | }; | 53 | }; |
54 | /* | ||
55 | * Updated from RM devinit_clock.c | ||
56 | * GV100 is 0x03 and | ||
57 | * GP10x is 0x02 in clocks_hal. | ||
58 | */ | ||
59 | static struct vbios_clocks_table_1x_hal_clock_entry | ||
60 | vbiosclktbl1xhalentry_gv[] = { | ||
61 | { clkwhich_gpcclk, true, }, | ||
62 | { clkwhich_xbarclk, true, }, | ||
63 | { clkwhich_mclk, false, }, | ||
64 | { clkwhich_sysclk, true, }, | ||
65 | { clkwhich_hubclk, false, }, | ||
66 | { clkwhich_nvdclk, true, }, | ||
67 | { clkwhich_pwrclk, false, }, | ||
68 | { clkwhich_dispclk, false, }, | ||
69 | { clkwhich_pciegenclk, false, }, | ||
70 | { clkwhich_hostclk, true, } | ||
71 | }; | ||
54 | 72 | ||
55 | static u32 clktranslatehalmumsettoapinumset(u32 clkhaldomains) | 73 | static u32 clktranslatehalmumsettoapinumset(u32 clkhaldomains) |
56 | { | 74 | { |
57 | u32 clkapidomains = 0; | 75 | u32 clkapidomains = 0; |
58 | 76 | ||
77 | if (clkhaldomains & BIT(clkwhich_gpcclk)) | ||
78 | clkapidomains |= CTRL_CLK_DOMAIN_GPCCLK; | ||
79 | if (clkhaldomains & BIT(clkwhich_xbarclk)) | ||
80 | clkapidomains |= CTRL_CLK_DOMAIN_XBARCLK; | ||
81 | if (clkhaldomains & BIT(clkwhich_sysclk)) | ||
82 | clkapidomains |= CTRL_CLK_DOMAIN_SYSCLK; | ||
83 | if (clkhaldomains & BIT(clkwhich_hubclk)) | ||
84 | clkapidomains |= CTRL_CLK_DOMAIN_HUBCLK; | ||
85 | if (clkhaldomains & BIT(clkwhich_hostclk)) | ||
86 | clkapidomains |= CTRL_CLK_DOMAIN_HOSTCLK; | ||
59 | if (clkhaldomains & BIT(clkwhich_gpc2clk)) | 87 | if (clkhaldomains & BIT(clkwhich_gpc2clk)) |
60 | clkapidomains |= CTRL_CLK_DOMAIN_GPC2CLK; | 88 | clkapidomains |= CTRL_CLK_DOMAIN_GPC2CLK; |
61 | if (clkhaldomains & BIT(clkwhich_xbar2clk)) | 89 | if (clkhaldomains & BIT(clkwhich_xbar2clk)) |
@@ -98,6 +126,7 @@ static u32 _clk_domains_pmudatainit_3x(struct gk20a *g, | |||
98 | 126 | ||
99 | pset->vbios_domains = pdomains->vbios_domains; | 127 | pset->vbios_domains = pdomains->vbios_domains; |
100 | pset->cntr_sampling_periodms = pdomains->cntr_sampling_periodms; | 128 | pset->cntr_sampling_periodms = pdomains->cntr_sampling_periodms; |
129 | pset->version = CLK_DOMAIN_BOARDOBJGRP_VERSION; | ||
101 | pset->b_override_o_v_o_c = false; | 130 | pset->b_override_o_v_o_c = false; |
102 | pset->b_debug_mode = false; | 131 | pset->b_debug_mode = false; |
103 | pset->b_enforce_vf_monotonicity = pdomains->b_enforce_vf_monotonicity; | 132 | pset->b_enforce_vf_monotonicity = pdomains->b_enforce_vf_monotonicity; |
@@ -255,6 +284,7 @@ static u32 devinit_get_clocks_table(struct gk20a *g, | |||
255 | u8 *clocks_table_ptr = NULL; | 284 | u8 *clocks_table_ptr = NULL; |
256 | struct vbios_clocks_table_1x_header clocks_table_header = { 0 }; | 285 | struct vbios_clocks_table_1x_header clocks_table_header = { 0 }; |
257 | struct vbios_clocks_table_1x_entry clocks_table_entry = { 0 }; | 286 | struct vbios_clocks_table_1x_entry clocks_table_entry = { 0 }; |
287 | struct vbios_clocks_table_1x_hal_clock_entry *vbiosclktbl1xhalentry; | ||
258 | u8 *clocks_tbl_entry_ptr = NULL; | 288 | u8 *clocks_tbl_entry_ptr = NULL; |
259 | u32 index = 0; | 289 | u32 index = 0; |
260 | struct clk_domain *pclkdomain_dev; | 290 | struct clk_domain *pclkdomain_dev; |
@@ -291,6 +321,18 @@ static u32 devinit_get_clocks_table(struct gk20a *g, | |||
291 | goto done; | 321 | goto done; |
292 | } | 322 | } |
293 | 323 | ||
324 | switch (clocks_table_header.clocks_hal) { | ||
325 | case CLK_TABLE_HAL_ENTRY_GP: | ||
326 | vbiosclktbl1xhalentry = vbiosclktbl1xhalentry_gp; | ||
327 | break; | ||
328 | case CLK_TABLE_HAL_ENTRY_GV: | ||
329 | vbiosclktbl1xhalentry = vbiosclktbl1xhalentry_gv; | ||
330 | break; | ||
331 | default: | ||
332 | status = -EINVAL; | ||
333 | goto done; | ||
334 | } | ||
335 | |||
294 | pclkdomainobjs->cntr_sampling_periodms = | 336 | pclkdomainobjs->cntr_sampling_periodms = |
295 | (u16)clocks_table_header.cntr_sampling_periodms; | 337 | (u16)clocks_table_header.cntr_sampling_periodms; |
296 | 338 | ||
@@ -330,7 +372,6 @@ static u32 devinit_get_clocks_table(struct gk20a *g, | |||
330 | clk_domain_data.v3x_prog.noise_unaware_ordering_index = | 372 | clk_domain_data.v3x_prog.noise_unaware_ordering_index = |
331 | (u8)(BIOS_GET_FIELD(clocks_table_entry.param2, | 373 | (u8)(BIOS_GET_FIELD(clocks_table_entry.param2, |
332 | NV_VBIOS_CLOCKS_TABLE_1X_ENTRY_PARAM2_PROG_NOISE_UNAWARE_ORDERING_IDX)); | 374 | NV_VBIOS_CLOCKS_TABLE_1X_ENTRY_PARAM2_PROG_NOISE_UNAWARE_ORDERING_IDX)); |
333 | |||
334 | if (clk_domain_data.v3x.b_noise_aware_capable) { | 375 | if (clk_domain_data.v3x.b_noise_aware_capable) { |
335 | clk_domain_data.v3x_prog.noise_aware_ordering_index = | 376 | clk_domain_data.v3x_prog.noise_aware_ordering_index = |
336 | (u8)(BIOS_GET_FIELD(clocks_table_entry.param2, | 377 | (u8)(BIOS_GET_FIELD(clocks_table_entry.param2, |
@@ -343,7 +384,9 @@ static u32 devinit_get_clocks_table(struct gk20a *g, | |||
343 | CTRL_CLK_CLK_DOMAIN_3X_PROG_ORDERING_INDEX_INVALID; | 384 | CTRL_CLK_CLK_DOMAIN_3X_PROG_ORDERING_INDEX_INVALID; |
344 | clk_domain_data.v3x_prog.b_force_noise_unaware_ordering = false; | 385 | clk_domain_data.v3x_prog.b_force_noise_unaware_ordering = false; |
345 | } | 386 | } |
346 | clk_domain_data.v3x_prog.factory_offset_khz = 0; | 387 | |
388 | clk_domain_data.v3x_prog.factory_delta.data.delta_khz = 0; | ||
389 | clk_domain_data.v3x_prog.factory_delta.type = 0; | ||
347 | 390 | ||
348 | clk_domain_data.v3x_prog.freq_delta_min_mhz = | 391 | clk_domain_data.v3x_prog.freq_delta_min_mhz = |
349 | (u16)(BIOS_GET_FIELD(clocks_table_entry.param1, | 392 | (u16)(BIOS_GET_FIELD(clocks_table_entry.param1, |
@@ -379,7 +422,8 @@ static u32 devinit_get_clocks_table(struct gk20a *g, | |||
379 | CTRL_CLK_CLK_DOMAIN_3X_PROG_ORDERING_INDEX_INVALID; | 422 | CTRL_CLK_CLK_DOMAIN_3X_PROG_ORDERING_INDEX_INVALID; |
380 | clk_domain_data.v3x_prog.b_force_noise_unaware_ordering = false; | 423 | clk_domain_data.v3x_prog.b_force_noise_unaware_ordering = false; |
381 | } | 424 | } |
382 | clk_domain_data.v3x_prog.factory_offset_khz = 0; | 425 | clk_domain_data.v3x_prog.factory_delta.data.delta_khz = 0; |
426 | clk_domain_data.v3x_prog.factory_delta.type = 0; | ||
383 | clk_domain_data.v3x_prog.freq_delta_min_mhz = 0; | 427 | clk_domain_data.v3x_prog.freq_delta_min_mhz = 0; |
384 | clk_domain_data.v3x_prog.freq_delta_max_mhz = 0; | 428 | clk_domain_data.v3x_prog.freq_delta_max_mhz = 0; |
385 | clk_domain_data.v3x_slave.master_idx = | 429 | clk_domain_data.v3x_slave.master_idx = |
@@ -771,7 +815,7 @@ static u32 _clk_domain_pmudatainit_3x_prog(struct gk20a *g, | |||
771 | pclk_domain_3x_prog->noise_aware_ordering_index; | 815 | pclk_domain_3x_prog->noise_aware_ordering_index; |
772 | pset->b_force_noise_unaware_ordering = | 816 | pset->b_force_noise_unaware_ordering = |
773 | pclk_domain_3x_prog->b_force_noise_unaware_ordering; | 817 | pclk_domain_3x_prog->b_force_noise_unaware_ordering; |
774 | pset->factory_offset_khz = pclk_domain_3x_prog->factory_offset_khz; | 818 | pset->factory_delta = pclk_domain_3x_prog->factory_delta; |
775 | pset->freq_delta_min_mhz = pclk_domain_3x_prog->freq_delta_min_mhz; | 819 | pset->freq_delta_min_mhz = pclk_domain_3x_prog->freq_delta_min_mhz; |
776 | pset->freq_delta_max_mhz = pclk_domain_3x_prog->freq_delta_max_mhz; | 820 | pset->freq_delta_max_mhz = pclk_domain_3x_prog->freq_delta_max_mhz; |
777 | memcpy(&pset->deltas, &pdomains->deltas, | 821 | memcpy(&pset->deltas, &pdomains->deltas, |
@@ -817,7 +861,7 @@ static u32 clk_domain_construct_3x_prog(struct gk20a *g, | |||
817 | ptmpdomain->noise_aware_ordering_index; | 861 | ptmpdomain->noise_aware_ordering_index; |
818 | pdomain->b_force_noise_unaware_ordering = | 862 | pdomain->b_force_noise_unaware_ordering = |
819 | ptmpdomain->b_force_noise_unaware_ordering; | 863 | ptmpdomain->b_force_noise_unaware_ordering; |
820 | pdomain->factory_offset_khz = ptmpdomain->factory_offset_khz; | 864 | pdomain->factory_delta = ptmpdomain->factory_delta; |
821 | pdomain->freq_delta_min_mhz = ptmpdomain->freq_delta_min_mhz; | 865 | pdomain->freq_delta_min_mhz = ptmpdomain->freq_delta_min_mhz; |
822 | pdomain->freq_delta_max_mhz = ptmpdomain->freq_delta_max_mhz; | 866 | pdomain->freq_delta_max_mhz = ptmpdomain->freq_delta_max_mhz; |
823 | 867 | ||