Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/pm: add mc register table initialization

Add mc register table initialization.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Evan Quan and committed by
Alex Deucher
5f92b48c 8f0804c6

+58
+37
drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.c
··· 166 166 return result; 167 167 } 168 168 169 + int atomctrl_initialize_mc_reg_table_v2_2( 170 + struct pp_hwmgr *hwmgr, 171 + uint8_t module_index, 172 + pp_atomctrl_mc_reg_table *table) 173 + { 174 + ATOM_VRAM_INFO_HEADER_V2_2 *vram_info; 175 + ATOM_INIT_REG_BLOCK *reg_block; 176 + int result = 0; 177 + u8 frev, crev; 178 + u16 size; 179 + 180 + vram_info = (ATOM_VRAM_INFO_HEADER_V2_2 *) 181 + smu_atom_get_data_table(hwmgr->adev, 182 + GetIndexIntoMasterTable(DATA, VRAM_Info), &size, &frev, &crev); 183 + 184 + if (module_index >= vram_info->ucNumOfVRAMModule) { 185 + pr_err("Invalid VramInfo table."); 186 + result = -1; 187 + } else if (vram_info->sHeader.ucTableFormatRevision < 2) { 188 + pr_err("Invalid VramInfo table."); 189 + result = -1; 190 + } 191 + 192 + if (0 == result) { 193 + reg_block = (ATOM_INIT_REG_BLOCK *) 194 + ((uint8_t *)vram_info + le16_to_cpu(vram_info->usMemClkPatchTblOffset)); 195 + result = atomctrl_set_mc_reg_address_table(reg_block, table); 196 + } 197 + 198 + if (0 == result) { 199 + result = atomctrl_retrieve_ac_timing(module_index, 200 + reg_block, table); 201 + } 202 + 203 + return result; 204 + } 205 + 169 206 /** 170 207 * Set DRAM timings based on engine clock and memory clock. 171 208 */
+1
drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.h
··· 299 299 extern int atomctrl_get_memory_clock_spread_spectrum(struct pp_hwmgr *hwmgr, const uint32_t memory_clock, pp_atomctrl_internal_ss_info *ssInfo); 300 300 extern int atomctrl_get_engine_clock_spread_spectrum(struct pp_hwmgr *hwmgr, const uint32_t engine_clock, pp_atomctrl_internal_ss_info *ssInfo); 301 301 extern int atomctrl_initialize_mc_reg_table(struct pp_hwmgr *hwmgr, uint8_t module_index, pp_atomctrl_mc_reg_table *table); 302 + extern int atomctrl_initialize_mc_reg_table_v2_2(struct pp_hwmgr *hwmgr, uint8_t module_index, pp_atomctrl_mc_reg_table *table); 302 303 extern int atomctrl_set_engine_dram_timings_rv770(struct pp_hwmgr *hwmgr, uint32_t engine_clock, uint32_t memory_clock); 303 304 extern uint32_t atomctrl_get_reference_clock(struct pp_hwmgr *hwmgr); 304 305 extern int atomctrl_get_memory_pll_dividers_si(struct pp_hwmgr *hwmgr, uint32_t clock_value, pp_atomctrl_memory_clock_param *mpll_param, bool strobe_mode);
+19
drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c
··· 2522 2522 return error ? -1 : 0; 2523 2523 } 2524 2524 2525 + static uint8_t polaris10_get_memory_modile_index(struct pp_hwmgr *hwmgr) 2526 + { 2527 + return (uint8_t) (0xFF & (cgs_read_register(hwmgr->device, mmBIOS_SCRATCH_4) >> 16)); 2528 + } 2529 + 2530 + static int polaris10_initialize_mc_reg_table(struct pp_hwmgr *hwmgr) 2531 + { 2532 + int result; 2533 + struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); 2534 + pp_atomctrl_mc_reg_table *mc_reg_table = &smu_data->mc_reg_table; 2535 + uint8_t module_index = polaris10_get_memory_modile_index(hwmgr); 2536 + 2537 + memset(mc_reg_table, 0, sizeof(pp_atomctrl_mc_reg_table)); 2538 + result = atomctrl_initialize_mc_reg_table_v2_2(hwmgr, module_index, mc_reg_table); 2539 + 2540 + return result; 2541 + } 2542 + 2525 2543 static bool polaris10_is_dpm_running(struct pp_hwmgr *hwmgr) 2526 2544 { 2527 2545 return (1 == PHM_READ_INDIRECT_FIELD(hwmgr->device, ··· 2666 2648 .populate_all_graphic_levels = polaris10_populate_all_graphic_levels, 2667 2649 .populate_all_memory_levels = polaris10_populate_all_memory_levels, 2668 2650 .get_mac_definition = polaris10_get_mac_definition, 2651 + .initialize_mc_reg_table = polaris10_initialize_mc_reg_table, 2669 2652 .is_dpm_running = polaris10_is_dpm_running, 2670 2653 .is_hw_avfs_present = polaris10_is_hw_avfs_present, 2671 2654 .update_dpm_settings = polaris10_update_dpm_settings,
+1
drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.h
··· 60 60 struct polaris10_range_table range_table[NUM_SCLK_RANGE]; 61 61 const struct polaris10_pt_defaults *power_tune_defaults; 62 62 uint32_t bif_sclk_table[SMU74_MAX_LEVELS_LINK]; 63 + pp_atomctrl_mc_reg_table mc_reg_table; 63 64 }; 64 65 65 66