drm/radeon/kms: add support for gen2 pcie link speeds
Supported on rv6xx/r7xx/evergreen. Cards come up in gen1 mode. Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
committed by
Dave Airlie
parent
3313e3d433
commit
9e46a48df2
@@ -39,6 +39,7 @@
|
||||
|
||||
static void evergreen_gpu_init(struct radeon_device *rdev);
|
||||
void evergreen_fini(struct radeon_device *rdev);
|
||||
static void evergreen_pcie_gen2_enable(struct radeon_device *rdev);
|
||||
|
||||
void evergreen_pre_page_flip(struct radeon_device *rdev, int crtc)
|
||||
{
|
||||
@@ -2767,6 +2768,9 @@ static int evergreen_startup(struct radeon_device *rdev)
|
||||
{
|
||||
int r;
|
||||
|
||||
/* enable pcie gen2 link */
|
||||
evergreen_pcie_gen2_enable(rdev);
|
||||
|
||||
if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) {
|
||||
r = r600_init_microcode(rdev);
|
||||
if (r) {
|
||||
@@ -3049,3 +3053,52 @@ void evergreen_fini(struct radeon_device *rdev)
|
||||
rdev->bios = NULL;
|
||||
radeon_dummy_page_fini(rdev);
|
||||
}
|
||||
|
||||
static void evergreen_pcie_gen2_enable(struct radeon_device *rdev)
|
||||
{
|
||||
u32 link_width_cntl, speed_cntl;
|
||||
|
||||
if (rdev->flags & RADEON_IS_IGP)
|
||||
return;
|
||||
|
||||
if (!(rdev->flags & RADEON_IS_PCIE))
|
||||
return;
|
||||
|
||||
/* x2 cards have a special sequence */
|
||||
if (ASIC_IS_X2(rdev))
|
||||
return;
|
||||
|
||||
speed_cntl = RREG32_PCIE_P(PCIE_LC_SPEED_CNTL);
|
||||
if ((speed_cntl & LC_OTHER_SIDE_EVER_SENT_GEN2) ||
|
||||
(speed_cntl & LC_OTHER_SIDE_SUPPORTS_GEN2)) {
|
||||
|
||||
link_width_cntl = RREG32_PCIE_P(PCIE_LC_LINK_WIDTH_CNTL);
|
||||
link_width_cntl &= ~LC_UPCONFIGURE_DIS;
|
||||
WREG32_PCIE_P(PCIE_LC_LINK_WIDTH_CNTL, link_width_cntl);
|
||||
|
||||
speed_cntl = RREG32_PCIE_P(PCIE_LC_SPEED_CNTL);
|
||||
speed_cntl &= ~LC_TARGET_LINK_SPEED_OVERRIDE_EN;
|
||||
WREG32_PCIE_P(PCIE_LC_SPEED_CNTL, speed_cntl);
|
||||
|
||||
speed_cntl = RREG32_PCIE_P(PCIE_LC_SPEED_CNTL);
|
||||
speed_cntl |= LC_CLR_FAILED_SPD_CHANGE_CNT;
|
||||
WREG32_PCIE_P(PCIE_LC_SPEED_CNTL, speed_cntl);
|
||||
|
||||
speed_cntl = RREG32_PCIE_P(PCIE_LC_SPEED_CNTL);
|
||||
speed_cntl &= ~LC_CLR_FAILED_SPD_CHANGE_CNT;
|
||||
WREG32_PCIE_P(PCIE_LC_SPEED_CNTL, speed_cntl);
|
||||
|
||||
speed_cntl = RREG32_PCIE_P(PCIE_LC_SPEED_CNTL);
|
||||
speed_cntl |= LC_GEN2_EN_STRAP;
|
||||
WREG32_PCIE_P(PCIE_LC_SPEED_CNTL, speed_cntl);
|
||||
|
||||
} else {
|
||||
link_width_cntl = RREG32_PCIE_P(PCIE_LC_LINK_WIDTH_CNTL);
|
||||
/* XXX: only disable it if gen1 bridge vendor == 0x111d or 0x1106 */
|
||||
if (1)
|
||||
link_width_cntl |= LC_UPCONFIGURE_DIS;
|
||||
else
|
||||
link_width_cntl &= ~LC_UPCONFIGURE_DIS;
|
||||
WREG32_PCIE_P(PCIE_LC_LINK_WIDTH_CNTL, link_width_cntl);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user