aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd
diff options
context:
space:
mode:
authorhersen wu <hersenxs.wu@amd.com>2019-06-26 13:06:07 -0400
committerAlex Deucher <alexander.deucher@amd.com>2019-07-18 15:12:08 -0400
commit41a5a2a8531f95d18bb4efddea581ccb469e8ee5 (patch)
treeef09199ae11386e89ab48057d6ce7fc4fa221cdc /drivers/gpu/drm/amd
parent8a5b5d425e5454fdef0e5457826f4aa7f96cf463 (diff)
drm/amd/display: init res_pool dccg_ref, dchub_ref with xtalin_freq
[WHY] dc sw clock implementation of navi10 and raven are not exact the same. dcccg, dchub reference clock initialization is done after dc calls vbios dispcontroller_init table. for raven family, before dispcontroller_init is called by dc, the ref clk values are referred by sw clock implementation and program asic register using wrong values. this causes dchub pstate error. This need provide valid ref clk values. for navi10, since dispcontroller_init is not called, dchubbub_global_timer_enable = 0, hubbub2_get_dchub_ref_freq will hit aeert. this need remove hubbub2_get_dchub_ref_freq from this location and move to dcn20_init_hw. [HOW] for all asic, initialize dccg, dchub ref clk with data from vbios firmware table by default. for raven asic family, use these data from vbios, for asic which support sw dccg component, like navi10, read ref clk by sw dccg functions and update the ref clk. Signed-off-by: hersen wu <hersenxs.wu@amd.com> Reviewed-by: Jun Lei <Jun.Lei@amd.com> Acked-by: Leo Li <sunpeng.li@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r--drivers/gpu/drm/amd/display/dc/core/dc_resource.c42
-rw-r--r--drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c25
2 files changed, 41 insertions, 26 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
index 48dfb305a0b0..51a78283a86d 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
@@ -175,32 +175,22 @@ struct resource_pool *dc_create_resource_pool(struct dc *dc,
175 if (res_pool != NULL) { 175 if (res_pool != NULL) {
176 struct dc_firmware_info fw_info = { { 0 } }; 176 struct dc_firmware_info fw_info = { { 0 } };
177 177
178 if (dc->ctx->dc_bios->funcs->get_firmware_info( 178 if (dc->ctx->dc_bios->funcs->get_firmware_info(dc->ctx->dc_bios,
179 dc->ctx->dc_bios, &fw_info) == BP_RESULT_OK) { 179 &fw_info) == BP_RESULT_OK) {
180 res_pool->ref_clocks.xtalin_clock_inKhz = fw_info.pll_info.crystal_frequency; 180 res_pool->ref_clocks.xtalin_clock_inKhz =
181 181 fw_info.pll_info.crystal_frequency;
182 if (IS_FPGA_MAXIMUS_DC(dc->ctx->dce_environment)) { 182 /* initialize with firmware data first, no all
183 // On FPGA these dividers are currently not configured by GDB 183 * ASIC have DCCG SW component. FPGA or
184 res_pool->ref_clocks.dccg_ref_clock_inKhz = res_pool->ref_clocks.xtalin_clock_inKhz; 184 * simulation need initialization of
185 res_pool->ref_clocks.dchub_ref_clock_inKhz = res_pool->ref_clocks.xtalin_clock_inKhz; 185 * dccg_ref_clock_inKhz, dchub_ref_clock_inKhz
186 } else if (res_pool->dccg && res_pool->hubbub) { 186 * with xtalin_clock_inKhz
187 // If DCCG reference frequency cannot be determined (usually means not set to xtalin) then this is a critical error 187 */
188 // as this value must be known for DCHUB programming 188 res_pool->ref_clocks.dccg_ref_clock_inKhz =
189 (res_pool->dccg->funcs->get_dccg_ref_freq)(res_pool->dccg, 189 res_pool->ref_clocks.xtalin_clock_inKhz;
190 fw_info.pll_info.crystal_frequency, 190 res_pool->ref_clocks.dchub_ref_clock_inKhz =
191 &res_pool->ref_clocks.dccg_ref_clock_inKhz); 191 res_pool->ref_clocks.xtalin_clock_inKhz;
192 192 } else
193 // Similarly, if DCHUB reference frequency cannot be determined, then it is also a critical error 193 ASSERT_CRITICAL(false);
194 (res_pool->hubbub->funcs->get_dchub_ref_freq)(res_pool->hubbub,
195 res_pool->ref_clocks.dccg_ref_clock_inKhz,
196 &res_pool->ref_clocks.dchub_ref_clock_inKhz);
197 } else {
198 // Not all ASICs have DCCG sw component
199 res_pool->ref_clocks.dccg_ref_clock_inKhz = res_pool->ref_clocks.xtalin_clock_inKhz;
200 res_pool->ref_clocks.dchub_ref_clock_inKhz = res_pool->ref_clocks.xtalin_clock_inKhz;
201 }
202 } else
203 ASSERT_CRITICAL(false);
204 } 194 }
205 195
206 return res_pool; 196 return res_pool;
diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
index 6925d25d2457..0b84a322b8a2 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
@@ -523,6 +523,7 @@ static void dcn20_init_hw(struct dc *dc)
523 struct dc_bios *dcb = dc->ctx->dc_bios; 523 struct dc_bios *dcb = dc->ctx->dc_bios;
524 struct resource_pool *res_pool = dc->res_pool; 524 struct resource_pool *res_pool = dc->res_pool;
525 struct dc_state *context = dc->current_state; 525 struct dc_state *context = dc->current_state;
526 struct dc_firmware_info fw_info = { { 0 } };
526 527
527 if (dc->clk_mgr && dc->clk_mgr->funcs->init_clocks) 528 if (dc->clk_mgr && dc->clk_mgr->funcs->init_clocks)
528 dc->clk_mgr->funcs->init_clocks(dc->clk_mgr); 529 dc->clk_mgr->funcs->init_clocks(dc->clk_mgr);
@@ -546,6 +547,30 @@ static void dcn20_init_hw(struct dc *dc)
546 } else { 547 } else {
547 if (!dcb->funcs->is_accelerated_mode(dcb)) { 548 if (!dcb->funcs->is_accelerated_mode(dcb)) {
548 bios_golden_init(dc); 549 bios_golden_init(dc);
550 if (dc->ctx->dc_bios->funcs->get_firmware_info(
551 dc->ctx->dc_bios, &fw_info) == BP_RESULT_OK) {
552 res_pool->ref_clocks.xtalin_clock_inKhz = fw_info.pll_info.crystal_frequency;
553
554 if (!IS_FPGA_MAXIMUS_DC(dc->ctx->dce_environment)) {
555 if (res_pool->dccg && res_pool->hubbub) {
556
557 (res_pool->dccg->funcs->get_dccg_ref_freq)(res_pool->dccg,
558 fw_info.pll_info.crystal_frequency,
559 &res_pool->ref_clocks.dccg_ref_clock_inKhz);
560
561 (res_pool->hubbub->funcs->get_dchub_ref_freq)(res_pool->hubbub,
562 res_pool->ref_clocks.dccg_ref_clock_inKhz,
563 &res_pool->ref_clocks.dchub_ref_clock_inKhz);
564 } else {
565 // Not all ASICs have DCCG sw component
566 res_pool->ref_clocks.dccg_ref_clock_inKhz =
567 res_pool->ref_clocks.xtalin_clock_inKhz;
568 res_pool->ref_clocks.dchub_ref_clock_inKhz =
569 res_pool->ref_clocks.xtalin_clock_inKhz;
570 }
571 }
572 } else
573 ASSERT_CRITICAL(false);
549 disable_vga(dc->hwseq); 574 disable_vga(dc->hwseq);
550 } 575 }
551 576