Skip to content

Commit 41a5a2a

Browse files
hersen wualexdeucher
authored andcommitted
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 <[email protected]> Reviewed-by: Jun Lei <[email protected]> Acked-by: Leo Li <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 8a5b5d4 commit 41a5a2a

File tree

2 files changed

+41
-26
lines changed

2 files changed

+41
-26
lines changed

drivers/gpu/drm/amd/display/dc/core/dc_resource.c

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -175,32 +175,22 @@ struct resource_pool *dc_create_resource_pool(struct dc *dc,
175175
if (res_pool != NULL) {
176176
struct dc_firmware_info fw_info = { { 0 } };
177177

178-
if (dc->ctx->dc_bios->funcs->get_firmware_info(
179-
dc->ctx->dc_bios, &fw_info) == BP_RESULT_OK) {
180-
res_pool->ref_clocks.xtalin_clock_inKhz = fw_info.pll_info.crystal_frequency;
181-
182-
if (IS_FPGA_MAXIMUS_DC(dc->ctx->dce_environment)) {
183-
// On FPGA these dividers are currently not configured by GDB
184-
res_pool->ref_clocks.dccg_ref_clock_inKhz = res_pool->ref_clocks.xtalin_clock_inKhz;
185-
res_pool->ref_clocks.dchub_ref_clock_inKhz = res_pool->ref_clocks.xtalin_clock_inKhz;
186-
} else if (res_pool->dccg && res_pool->hubbub) {
187-
// If DCCG reference frequency cannot be determined (usually means not set to xtalin) then this is a critical error
188-
// as this value must be known for DCHUB programming
189-
(res_pool->dccg->funcs->get_dccg_ref_freq)(res_pool->dccg,
190-
fw_info.pll_info.crystal_frequency,
191-
&res_pool->ref_clocks.dccg_ref_clock_inKhz);
192-
193-
// Similarly, if DCHUB reference frequency cannot be determined, then it is also a critical error
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);
178+
if (dc->ctx->dc_bios->funcs->get_firmware_info(dc->ctx->dc_bios,
179+
&fw_info) == BP_RESULT_OK) {
180+
res_pool->ref_clocks.xtalin_clock_inKhz =
181+
fw_info.pll_info.crystal_frequency;
182+
/* initialize with firmware data first, no all
183+
* ASIC have DCCG SW component. FPGA or
184+
* simulation need initialization of
185+
* dccg_ref_clock_inKhz, dchub_ref_clock_inKhz
186+
* with xtalin_clock_inKhz
187+
*/
188+
res_pool->ref_clocks.dccg_ref_clock_inKhz =
189+
res_pool->ref_clocks.xtalin_clock_inKhz;
190+
res_pool->ref_clocks.dchub_ref_clock_inKhz =
191+
res_pool->ref_clocks.xtalin_clock_inKhz;
192+
} else
193+
ASSERT_CRITICAL(false);
204194
}
205195

206196
return res_pool;

drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,7 @@ static void dcn20_init_hw(struct dc *dc)
523523
struct dc_bios *dcb = dc->ctx->dc_bios;
524524
struct resource_pool *res_pool = dc->res_pool;
525525
struct dc_state *context = dc->current_state;
526+
struct dc_firmware_info fw_info = { { 0 } };
526527

527528
if (dc->clk_mgr && dc->clk_mgr->funcs->init_clocks)
528529
dc->clk_mgr->funcs->init_clocks(dc->clk_mgr);
@@ -546,6 +547,30 @@ static void dcn20_init_hw(struct dc *dc)
546547
} else {
547548
if (!dcb->funcs->is_accelerated_mode(dcb)) {
548549
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);
549574
disable_vga(dc->hwseq);
550575
}
551576

0 commit comments

Comments
 (0)