aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2013-03-18 18:52:13 -0400
committerAlex Deucher <alexander.deucher@amd.com>2013-04-09 10:31:41 -0400
commitd5445a17e7020226f1128a3771af05443f36da5a (patch)
tree314fb40a803c2b4b2bd94595d824b31f62b6a1f6 /drivers/gpu/drm/radeon
parent492d2b61b3c73345015b5601f493e9e92ea1a56e (diff)
drm/radeon: update r600 set/get pcie lane config
Updated to the preferred programming sequence. Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/radeon')
-rw-r--r--drivers/gpu/drm/radeon/r600.c57
1 files changed, 15 insertions, 42 deletions
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 4b7c2d8ee004..5fe9e74d6360 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -4523,7 +4523,7 @@ void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo)
4523 4523
4524void r600_set_pcie_lanes(struct radeon_device *rdev, int lanes) 4524void r600_set_pcie_lanes(struct radeon_device *rdev, int lanes)
4525{ 4525{
4526 u32 link_width_cntl, mask, target_reg; 4526 u32 link_width_cntl, mask;
4527 4527
4528 if (rdev->flags & RADEON_IS_IGP) 4528 if (rdev->flags & RADEON_IS_IGP)
4529 return; 4529 return;
@@ -4535,7 +4535,7 @@ void r600_set_pcie_lanes(struct radeon_device *rdev, int lanes)
4535 if (ASIC_IS_X2(rdev)) 4535 if (ASIC_IS_X2(rdev))
4536 return; 4536 return;
4537 4537
4538 /* FIXME wait for idle */ 4538 radeon_gui_idle(rdev);
4539 4539
4540 switch (lanes) { 4540 switch (lanes) {
4541 case 0: 4541 case 0:
@@ -4554,53 +4554,24 @@ void r600_set_pcie_lanes(struct radeon_device *rdev, int lanes)
4554 mask = RADEON_PCIE_LC_LINK_WIDTH_X8; 4554 mask = RADEON_PCIE_LC_LINK_WIDTH_X8;
4555 break; 4555 break;
4556 case 12: 4556 case 12:
4557 /* not actually supported */
4557 mask = RADEON_PCIE_LC_LINK_WIDTH_X12; 4558 mask = RADEON_PCIE_LC_LINK_WIDTH_X12;
4558 break; 4559 break;
4559 case 16: 4560 case 16:
4560 default:
4561 mask = RADEON_PCIE_LC_LINK_WIDTH_X16; 4561 mask = RADEON_PCIE_LC_LINK_WIDTH_X16;
4562 break; 4562 break;
4563 default:
4564 DRM_ERROR("invalid pcie lane request: %d\n", lanes);
4565 return;
4563 } 4566 }
4564 4567
4565 link_width_cntl = RREG32_PCIE_PORT(RADEON_PCIE_LC_LINK_WIDTH_CNTL); 4568 link_width_cntl = RREG32_PCIE_PORT(RADEON_PCIE_LC_LINK_WIDTH_CNTL);
4566 4569 link_width_cntl &= ~RADEON_PCIE_LC_LINK_WIDTH_MASK;
4567 if ((link_width_cntl & RADEON_PCIE_LC_LINK_WIDTH_RD_MASK) == 4570 link_width_cntl |= mask << RADEON_PCIE_LC_LINK_WIDTH_SHIFT;
4568 (mask << RADEON_PCIE_LC_LINK_WIDTH_RD_SHIFT)) 4571 link_width_cntl |= (RADEON_PCIE_LC_RECONFIG_NOW |
4569 return; 4572 R600_PCIE_LC_RECONFIG_ARC_MISSING_ESCAPE);
4570
4571 if (link_width_cntl & R600_PCIE_LC_UPCONFIGURE_DIS)
4572 return;
4573
4574 link_width_cntl &= ~(RADEON_PCIE_LC_LINK_WIDTH_MASK |
4575 RADEON_PCIE_LC_RECONFIG_NOW |
4576 R600_PCIE_LC_RENEGOTIATE_EN |
4577 R600_PCIE_LC_RECONFIG_ARC_MISSING_ESCAPE);
4578 link_width_cntl |= mask;
4579 4573
4580 WREG32_PCIE_PORT(RADEON_PCIE_LC_LINK_WIDTH_CNTL, link_width_cntl); 4574 WREG32_PCIE_PORT(RADEON_PCIE_LC_LINK_WIDTH_CNTL, link_width_cntl);
4581
4582 /* some northbridges can renegotiate the link rather than requiring
4583 * a complete re-config.
4584 * e.g., AMD 780/790 northbridges (pci ids: 0x5956, 0x5957, 0x5958, etc.)
4585 */
4586 if (link_width_cntl & R600_PCIE_LC_RENEGOTIATION_SUPPORT)
4587 link_width_cntl |= R600_PCIE_LC_RENEGOTIATE_EN | R600_PCIE_LC_UPCONFIGURE_SUPPORT;
4588 else
4589 link_width_cntl |= R600_PCIE_LC_RECONFIG_ARC_MISSING_ESCAPE;
4590
4591 WREG32_PCIE_PORT(RADEON_PCIE_LC_LINK_WIDTH_CNTL, (link_width_cntl |
4592 RADEON_PCIE_LC_RECONFIG_NOW));
4593
4594 if (rdev->family >= CHIP_RV770)
4595 target_reg = R700_TARGET_AND_CURRENT_PROFILE_INDEX;
4596 else
4597 target_reg = R600_TARGET_AND_CURRENT_PROFILE_INDEX;
4598
4599 /* wait for lane set to complete */
4600 link_width_cntl = RREG32(target_reg);
4601 while (link_width_cntl == 0xffffffff)
4602 link_width_cntl = RREG32(target_reg);
4603
4604} 4575}
4605 4576
4606int r600_get_pcie_lanes(struct radeon_device *rdev) 4577int r600_get_pcie_lanes(struct radeon_device *rdev)
@@ -4617,13 +4588,11 @@ int r600_get_pcie_lanes(struct radeon_device *rdev)
4617 if (ASIC_IS_X2(rdev)) 4588 if (ASIC_IS_X2(rdev))
4618 return 0; 4589 return 0;
4619 4590
4620 /* FIXME wait for idle */ 4591 radeon_gui_idle(rdev);
4621 4592
4622 link_width_cntl = RREG32_PCIE_PORT(RADEON_PCIE_LC_LINK_WIDTH_CNTL); 4593 link_width_cntl = RREG32_PCIE_PORT(RADEON_PCIE_LC_LINK_WIDTH_CNTL);
4623 4594
4624 switch ((link_width_cntl & RADEON_PCIE_LC_LINK_WIDTH_RD_MASK) >> RADEON_PCIE_LC_LINK_WIDTH_RD_SHIFT) { 4595 switch ((link_width_cntl & RADEON_PCIE_LC_LINK_WIDTH_RD_MASK) >> RADEON_PCIE_LC_LINK_WIDTH_RD_SHIFT) {
4625 case RADEON_PCIE_LC_LINK_WIDTH_X0:
4626 return 0;
4627 case RADEON_PCIE_LC_LINK_WIDTH_X1: 4596 case RADEON_PCIE_LC_LINK_WIDTH_X1:
4628 return 1; 4597 return 1;
4629 case RADEON_PCIE_LC_LINK_WIDTH_X2: 4598 case RADEON_PCIE_LC_LINK_WIDTH_X2:
@@ -4632,6 +4601,10 @@ int r600_get_pcie_lanes(struct radeon_device *rdev)
4632 return 4; 4601 return 4;
4633 case RADEON_PCIE_LC_LINK_WIDTH_X8: 4602 case RADEON_PCIE_LC_LINK_WIDTH_X8:
4634 return 8; 4603 return 8;
4604 case RADEON_PCIE_LC_LINK_WIDTH_X12:
4605 /* not actually supported */
4606 return 12;
4607 case RADEON_PCIE_LC_LINK_WIDTH_X0:
4635 case RADEON_PCIE_LC_LINK_WIDTH_X16: 4608 case RADEON_PCIE_LC_LINK_WIDTH_X16:
4636 default: 4609 default:
4637 return 16; 4610 return 16;