Skip to content

Commit

Permalink
drm/amdgpu: adjust register address calculation
Browse files Browse the repository at this point in the history
the UMC_STATUS register is not linear, adjust offset
calculation formula to get correct address

Signed-off-by: Stanley.Yang <Stanley.Yang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Stanley.Yang authored and Alex Deucher committed Feb 11, 2022
1 parent f3986e8 commit 1915a43
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/gpu/drm/amd/amdgpu/umc_v6_7.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ static inline uint32_t get_umc_v6_7_reg_offset(struct amdgpu_device *adev,
uint32_t umc_inst,
uint32_t ch_inst)
{
uint32_t index = umc_inst * adev->umc.channel_inst_num + ch_inst;

/* adjust umc and channel index offset,
* the register address is not linear on each umc instace */
umc_inst = index / 4;
ch_inst = index % 4;

return adev->umc.channel_offs * ch_inst + UMC_V6_7_INST_DIST * umc_inst;
}

Expand Down

0 comments on commit 1915a43

Please sign in to comment.