diff options
author | Rex Zhu <Rex.Zhu@amd.com> | 2016-12-21 07:32:38 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-01-27 11:12:57 -0500 |
commit | ae6a58e4090365f0ed6b24e0a67b8a08f6b55856 (patch) | |
tree | e799a62f89f14e5a203c196ab1ef27d76c270c94 /drivers/gpu | |
parent | 3bd58979648fd105258934fb9f0fea1d73341d08 (diff) |
drm/amdgpu: use same enter/exit safe mode for gfx_8.
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 95 |
1 files changed, 1 insertions, 94 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index 5ab53d7b4bad..71ab1eb47909 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | |||
@@ -5445,68 +5445,6 @@ static void gfx_v8_0_send_serdes_cmd(struct amdgpu_device *adev, | |||
5445 | #define RLC_GPR_REG2__MESSAGE__SHIFT 0x00000001 | 5445 | #define RLC_GPR_REG2__MESSAGE__SHIFT 0x00000001 |
5446 | #define RLC_GPR_REG2__MESSAGE_MASK 0x0000001e | 5446 | #define RLC_GPR_REG2__MESSAGE_MASK 0x0000001e |
5447 | 5447 | ||
5448 | static void cz_enter_rlc_safe_mode(struct amdgpu_device *adev) | ||
5449 | { | ||
5450 | u32 data = 0; | ||
5451 | unsigned i; | ||
5452 | |||
5453 | data = RREG32(mmRLC_CNTL); | ||
5454 | if ((data & RLC_CNTL__RLC_ENABLE_F32_MASK) == 0) | ||
5455 | return; | ||
5456 | |||
5457 | if ((adev->cg_flags & (AMD_CG_SUPPORT_GFX_CGCG | AMD_CG_SUPPORT_GFX_MGCG)) || | ||
5458 | (adev->pg_flags & (AMD_PG_SUPPORT_GFX_PG | AMD_PG_SUPPORT_GFX_SMG | | ||
5459 | AMD_PG_SUPPORT_GFX_DMG))) { | ||
5460 | data |= RLC_GPR_REG2__REQ_MASK; | ||
5461 | data &= ~RLC_GPR_REG2__MESSAGE_MASK; | ||
5462 | data |= (MSG_ENTER_RLC_SAFE_MODE << RLC_GPR_REG2__MESSAGE__SHIFT); | ||
5463 | WREG32(mmRLC_GPR_REG2, data); | ||
5464 | |||
5465 | for (i = 0; i < adev->usec_timeout; i++) { | ||
5466 | if ((RREG32(mmRLC_GPM_STAT) & | ||
5467 | (RLC_GPM_STAT__GFX_CLOCK_STATUS_MASK | | ||
5468 | RLC_GPM_STAT__GFX_POWER_STATUS_MASK)) == | ||
5469 | (RLC_GPM_STAT__GFX_CLOCK_STATUS_MASK | | ||
5470 | RLC_GPM_STAT__GFX_POWER_STATUS_MASK)) | ||
5471 | break; | ||
5472 | udelay(1); | ||
5473 | } | ||
5474 | |||
5475 | for (i = 0; i < adev->usec_timeout; i++) { | ||
5476 | if (!REG_GET_FIELD(RREG32(mmRLC_GPR_REG2), RLC_GPR_REG2, REQ)) | ||
5477 | break; | ||
5478 | udelay(1); | ||
5479 | } | ||
5480 | adev->gfx.rlc.in_safe_mode = true; | ||
5481 | } | ||
5482 | } | ||
5483 | |||
5484 | static void cz_exit_rlc_safe_mode(struct amdgpu_device *adev) | ||
5485 | { | ||
5486 | u32 data; | ||
5487 | unsigned i; | ||
5488 | |||
5489 | data = RREG32(mmRLC_CNTL); | ||
5490 | if ((data & RLC_CNTL__RLC_ENABLE_F32_MASK) == 0) | ||
5491 | return; | ||
5492 | |||
5493 | if ((adev->cg_flags & (AMD_CG_SUPPORT_GFX_CGCG | AMD_CG_SUPPORT_GFX_MGCG)) || | ||
5494 | (adev->pg_flags & (AMD_PG_SUPPORT_GFX_PG | AMD_PG_SUPPORT_GFX_SMG | | ||
5495 | AMD_PG_SUPPORT_GFX_DMG))) { | ||
5496 | data |= RLC_GPR_REG2__REQ_MASK; | ||
5497 | data &= ~RLC_GPR_REG2__MESSAGE_MASK; | ||
5498 | data |= (MSG_EXIT_RLC_SAFE_MODE << RLC_GPR_REG2__MESSAGE__SHIFT); | ||
5499 | WREG32(mmRLC_GPR_REG2, data); | ||
5500 | adev->gfx.rlc.in_safe_mode = false; | ||
5501 | } | ||
5502 | |||
5503 | for (i = 0; i < adev->usec_timeout; i++) { | ||
5504 | if (!REG_GET_FIELD(RREG32(mmRLC_GPR_REG2), RLC_GPR_REG2, REQ)) | ||
5505 | break; | ||
5506 | udelay(1); | ||
5507 | } | ||
5508 | } | ||
5509 | |||
5510 | static void iceland_enter_rlc_safe_mode(struct amdgpu_device *adev) | 5448 | static void iceland_enter_rlc_safe_mode(struct amdgpu_device *adev) |
5511 | { | 5449 | { |
5512 | u32 data; | 5450 | u32 data; |
@@ -5566,31 +5504,11 @@ static void iceland_exit_rlc_safe_mode(struct amdgpu_device *adev) | |||
5566 | } | 5504 | } |
5567 | } | 5505 | } |
5568 | 5506 | ||
5569 | static void gfx_v8_0_nop_enter_rlc_safe_mode(struct amdgpu_device *adev) | ||
5570 | { | ||
5571 | adev->gfx.rlc.in_safe_mode = true; | ||
5572 | } | ||
5573 | |||
5574 | static void gfx_v8_0_nop_exit_rlc_safe_mode(struct amdgpu_device *adev) | ||
5575 | { | ||
5576 | adev->gfx.rlc.in_safe_mode = false; | ||
5577 | } | ||
5578 | |||
5579 | static const struct amdgpu_rlc_funcs cz_rlc_funcs = { | ||
5580 | .enter_safe_mode = cz_enter_rlc_safe_mode, | ||
5581 | .exit_safe_mode = cz_exit_rlc_safe_mode | ||
5582 | }; | ||
5583 | |||
5584 | static const struct amdgpu_rlc_funcs iceland_rlc_funcs = { | 5507 | static const struct amdgpu_rlc_funcs iceland_rlc_funcs = { |
5585 | .enter_safe_mode = iceland_enter_rlc_safe_mode, | 5508 | .enter_safe_mode = iceland_enter_rlc_safe_mode, |
5586 | .exit_safe_mode = iceland_exit_rlc_safe_mode | 5509 | .exit_safe_mode = iceland_exit_rlc_safe_mode |
5587 | }; | 5510 | }; |
5588 | 5511 | ||
5589 | static const struct amdgpu_rlc_funcs gfx_v8_0_nop_rlc_funcs = { | ||
5590 | .enter_safe_mode = gfx_v8_0_nop_enter_rlc_safe_mode, | ||
5591 | .exit_safe_mode = gfx_v8_0_nop_exit_rlc_safe_mode | ||
5592 | }; | ||
5593 | |||
5594 | static void gfx_v8_0_update_medium_grain_clock_gating(struct amdgpu_device *adev, | 5512 | static void gfx_v8_0_update_medium_grain_clock_gating(struct amdgpu_device *adev, |
5595 | bool enable) | 5513 | bool enable) |
5596 | { | 5514 | { |
@@ -6526,18 +6444,7 @@ static void gfx_v8_0_set_irq_funcs(struct amdgpu_device *adev) | |||
6526 | 6444 | ||
6527 | static void gfx_v8_0_set_rlc_funcs(struct amdgpu_device *adev) | 6445 | static void gfx_v8_0_set_rlc_funcs(struct amdgpu_device *adev) |
6528 | { | 6446 | { |
6529 | switch (adev->asic_type) { | 6447 | adev->gfx.rlc.funcs = &iceland_rlc_funcs; |
6530 | case CHIP_TOPAZ: | ||
6531 | adev->gfx.rlc.funcs = &iceland_rlc_funcs; | ||
6532 | break; | ||
6533 | case CHIP_STONEY: | ||
6534 | case CHIP_CARRIZO: | ||
6535 | adev->gfx.rlc.funcs = &cz_rlc_funcs; | ||
6536 | break; | ||
6537 | default: | ||
6538 | adev->gfx.rlc.funcs = &gfx_v8_0_nop_rlc_funcs; | ||
6539 | break; | ||
6540 | } | ||
6541 | } | 6448 | } |
6542 | 6449 | ||
6543 | static void gfx_v8_0_set_gds_init(struct amdgpu_device *adev) | 6450 | static void gfx_v8_0_set_gds_init(struct amdgpu_device *adev) |