aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
diff options
context:
space:
mode:
authorKen Wang <Ken.Wang@amd.com>2017-07-04 01:11:52 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-07-14 11:06:06 -0400
commit47ed4e1c93a6c73f313022369c12ddd693890715 (patch)
tree3e822ce6750a35088368b8134a15353a82dc01c2 /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
parent4426826c02dc367ec3c245ef5c5ca4dcdb45b4c8 (diff)
drm/amdgpu: add workaround for S3 issues on some vega10 boards
Certain MC registers need a delay after writing them to properly update in the init sequence. Signed-off-by: Ken Wang <Ken.Wang@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 7963c54e5d03..8ce522b490c8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -129,6 +129,10 @@ void amdgpu_mm_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v,
129{ 129{
130 trace_amdgpu_mm_wreg(adev->pdev->device, reg, v); 130 trace_amdgpu_mm_wreg(adev->pdev->device, reg, v);
131 131
132 if (adev->asic_type >= CHIP_VEGA10 && reg == 0) {
133 adev->last_mm_index = v;
134 }
135
132 if (!(acc_flags & AMDGPU_REGS_NO_KIQ) && amdgpu_sriov_runtime(adev)) { 136 if (!(acc_flags & AMDGPU_REGS_NO_KIQ) && amdgpu_sriov_runtime(adev)) {
133 BUG_ON(in_interrupt()); 137 BUG_ON(in_interrupt());
134 return amdgpu_virt_kiq_wreg(adev, reg, v); 138 return amdgpu_virt_kiq_wreg(adev, reg, v);
@@ -144,6 +148,10 @@ void amdgpu_mm_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v,
144 writel(v, ((void __iomem *)adev->rmmio) + (mmMM_DATA * 4)); 148 writel(v, ((void __iomem *)adev->rmmio) + (mmMM_DATA * 4));
145 spin_unlock_irqrestore(&adev->mmio_idx_lock, flags); 149 spin_unlock_irqrestore(&adev->mmio_idx_lock, flags);
146 } 150 }
151
152 if (adev->asic_type >= CHIP_VEGA10 && reg == 1 && adev->last_mm_index == 0x5702C) {
153 udelay(500);
154 }
147} 155}
148 156
149u32 amdgpu_io_rreg(struct amdgpu_device *adev, u32 reg) 157u32 amdgpu_io_rreg(struct amdgpu_device *adev, u32 reg)
@@ -158,6 +166,9 @@ u32 amdgpu_io_rreg(struct amdgpu_device *adev, u32 reg)
158 166
159void amdgpu_io_wreg(struct amdgpu_device *adev, u32 reg, u32 v) 167void amdgpu_io_wreg(struct amdgpu_device *adev, u32 reg, u32 v)
160{ 168{
169 if (adev->asic_type >= CHIP_VEGA10 && reg == 0) {
170 adev->last_mm_index = v;
171 }
161 172
162 if ((reg * 4) < adev->rio_mem_size) 173 if ((reg * 4) < adev->rio_mem_size)
163 iowrite32(v, adev->rio_mem + (reg * 4)); 174 iowrite32(v, adev->rio_mem + (reg * 4));
@@ -165,6 +176,10 @@ void amdgpu_io_wreg(struct amdgpu_device *adev, u32 reg, u32 v)
165 iowrite32((reg * 4), adev->rio_mem + (mmMM_INDEX * 4)); 176 iowrite32((reg * 4), adev->rio_mem + (mmMM_INDEX * 4));
166 iowrite32(v, adev->rio_mem + (mmMM_DATA * 4)); 177 iowrite32(v, adev->rio_mem + (mmMM_DATA * 4));
167 } 178 }
179
180 if (adev->asic_type >= CHIP_VEGA10 && reg == 1 && adev->last_mm_index == 0x5702C) {
181 udelay(500);
182 }
168} 183}
169 184
170/** 185/**