aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKleber Sacilotto de Souza <klebers@linux.vnet.ibm.com>2013-05-03 18:43:13 -0400
committerAlex Deucher <alexander.deucher@amd.com>2013-05-29 12:36:12 -0400
commit7e0e41963740525af702bb23edede8ae9afc4ac0 (patch)
treeb26034a6a42ea58d952f87e83e51c5e55d653d1c
parent50a583f64bfe53aae4996965c1d1b25d90ce4f64 (diff)
radeon: use max_bus_speed to activate gen2 speeds
radeon currently uses a drm function to get the speed capabilities for the bus, drm_pcie_get_speed_cap_mask. However, this is a non-standard method of performing this detection and this patch changes it to use the max_bus_speed attribute. From: Lucas Kannebley Tavares <lucaskt@linux.vnet.ibm.com> Signed-off-by: Kleber Sacilotto de Souza <klebers@linux.vnet.ibm.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c10
-rw-r--r--drivers/gpu/drm/radeon/r600.c9
-rw-r--r--drivers/gpu/drm/radeon/rv770.c9
3 files changed, 7 insertions, 21 deletions
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 8f9e2d31b255..8546e3b333b4 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -4999,8 +4999,7 @@ void evergreen_fini(struct radeon_device *rdev)
4999 4999
5000void evergreen_pcie_gen2_enable(struct radeon_device *rdev) 5000void evergreen_pcie_gen2_enable(struct radeon_device *rdev)
5001{ 5001{
5002 u32 link_width_cntl, speed_cntl, mask; 5002 u32 link_width_cntl, speed_cntl;
5003 int ret;
5004 5003
5005 if (radeon_pcie_gen2 == 0) 5004 if (radeon_pcie_gen2 == 0)
5006 return; 5005 return;
@@ -5015,11 +5014,8 @@ void evergreen_pcie_gen2_enable(struct radeon_device *rdev)
5015 if (ASIC_IS_X2(rdev)) 5014 if (ASIC_IS_X2(rdev))
5016 return; 5015 return;
5017 5016
5018 ret = drm_pcie_get_speed_cap_mask(rdev->ddev, &mask); 5017 if ((rdev->pdev->bus->max_bus_speed != PCIE_SPEED_5_0GT) &&
5019 if (ret != 0) 5018 (rdev->pdev->bus->max_bus_speed != PCIE_SPEED_8_0GT))
5020 return;
5021
5022 if (!(mask & DRM_PCIE_SPEED_50))
5023 return; 5019 return;
5024 5020
5025 speed_cntl = RREG32_PCIE_PORT(PCIE_LC_SPEED_CNTL); 5021 speed_cntl = RREG32_PCIE_PORT(PCIE_LC_SPEED_CNTL);
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 1a08008c978b..b45e64848677 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -4631,8 +4631,6 @@ static void r600_pcie_gen2_enable(struct radeon_device *rdev)
4631{ 4631{
4632 u32 link_width_cntl, lanes, speed_cntl, training_cntl, tmp; 4632 u32 link_width_cntl, lanes, speed_cntl, training_cntl, tmp;
4633 u16 link_cntl2; 4633 u16 link_cntl2;
4634 u32 mask;
4635 int ret;
4636 4634
4637 if (radeon_pcie_gen2 == 0) 4635 if (radeon_pcie_gen2 == 0)
4638 return; 4636 return;
@@ -4651,11 +4649,8 @@ static void r600_pcie_gen2_enable(struct radeon_device *rdev)
4651 if (rdev->family <= CHIP_R600) 4649 if (rdev->family <= CHIP_R600)
4652 return; 4650 return;
4653 4651
4654 ret = drm_pcie_get_speed_cap_mask(rdev->ddev, &mask); 4652 if ((rdev->pdev->bus->max_bus_speed != PCIE_SPEED_5_0GT) &&
4655 if (ret != 0) 4653 (rdev->pdev->bus->max_bus_speed != PCIE_SPEED_8_0GT))
4656 return;
4657
4658 if (!(mask & DRM_PCIE_SPEED_50))
4659 return; 4654 return;
4660 4655
4661 speed_cntl = RREG32_PCIE_PORT(PCIE_LC_SPEED_CNTL); 4656 speed_cntl = RREG32_PCIE_PORT(PCIE_LC_SPEED_CNTL);
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index 3fc2985445ee..08aef24afe40 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -2111,8 +2111,6 @@ static void rv770_pcie_gen2_enable(struct radeon_device *rdev)
2111{ 2111{
2112 u32 link_width_cntl, lanes, speed_cntl, tmp; 2112 u32 link_width_cntl, lanes, speed_cntl, tmp;
2113 u16 link_cntl2; 2113 u16 link_cntl2;
2114 u32 mask;
2115 int ret;
2116 2114
2117 if (radeon_pcie_gen2 == 0) 2115 if (radeon_pcie_gen2 == 0)
2118 return; 2116 return;
@@ -2127,11 +2125,8 @@ static void rv770_pcie_gen2_enable(struct radeon_device *rdev)
2127 if (ASIC_IS_X2(rdev)) 2125 if (ASIC_IS_X2(rdev))
2128 return; 2126 return;
2129 2127
2130 ret = drm_pcie_get_speed_cap_mask(rdev->ddev, &mask); 2128 if ((rdev->pdev->bus->max_bus_speed != PCIE_SPEED_5_0GT) &&
2131 if (ret != 0) 2129 (rdev->pdev->bus->max_bus_speed != PCIE_SPEED_8_0GT))
2132 return;
2133
2134 if (!(mask & DRM_PCIE_SPEED_50))
2135 return; 2130 return;
2136 2131
2137 DRM_INFO("enabling PCIE gen 2 link speeds, disable with radeon.pcie_gen2=0\n"); 2132 DRM_INFO("enabling PCIE gen 2 link speeds, disable with radeon.pcie_gen2=0\n");