aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/radeon_cp.c
diff options
context:
space:
mode:
authorMaciej Cencora <m.cencora@gmail.com>2008-02-19 06:32:45 -0500
committerDave Airlie <airlied@redhat.com>2008-02-19 18:35:42 -0500
commit60f92683943c5b7a85963b283d6f8a853aa09203 (patch)
tree0291f47cc073c218cdd393b99735d8c428c540af /drivers/char/drm/radeon_cp.c
parent00e962c5408b9f2d0bebd2308673fe982cb9a5fe (diff)
drm/radeon: add initial rs690 support to drm.
This adds support for configuring the RS690 GART. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/char/drm/radeon_cp.c')
-rw-r--r--drivers/char/drm/radeon_cp.c81
1 files changed, 81 insertions, 0 deletions
diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c
index 5dc799ab86b8..833abc7e55fb 100644
--- a/drivers/char/drm/radeon_cp.c
+++ b/drivers/char/drm/radeon_cp.c
@@ -825,11 +825,19 @@ static u32 RADEON_READ_MCIND(drm_radeon_private_t *dev_priv, int addr)
825 return ret; 825 return ret;
826} 826}
827 827
828static u32 RS690_READ_MCIND(drm_radeon_private_t *dev_priv, int addr)
829{
830 RADEON_WRITE(RS690_MC_INDEX, (addr & RS690_MC_INDEX_MASK));
831 return RADEON_READ(RS690_MC_DATA);
832}
833
828u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv) 834u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv)
829{ 835{
830 836
831 if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) 837 if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515)
832 return RADEON_READ_MCIND(dev_priv, RV515_MC_FB_LOCATION); 838 return RADEON_READ_MCIND(dev_priv, RV515_MC_FB_LOCATION);
839 else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690)
840 return RS690_READ_MCIND(dev_priv, RS690_MC_FB_LOCATION);
833 else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515) 841 else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515)
834 return RADEON_READ_MCIND(dev_priv, R520_MC_FB_LOCATION); 842 return RADEON_READ_MCIND(dev_priv, R520_MC_FB_LOCATION);
835 else 843 else
@@ -840,6 +848,8 @@ static void radeon_write_fb_location(drm_radeon_private_t *dev_priv, u32 fb_loc)
840{ 848{
841 if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) 849 if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515)
842 RADEON_WRITE_MCIND(RV515_MC_FB_LOCATION, fb_loc); 850 RADEON_WRITE_MCIND(RV515_MC_FB_LOCATION, fb_loc);
851 else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690)
852 RS690_WRITE_MCIND(RS690_MC_FB_LOCATION, fb_loc);
843 else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515) 853 else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515)
844 RADEON_WRITE_MCIND(R520_MC_FB_LOCATION, fb_loc); 854 RADEON_WRITE_MCIND(R520_MC_FB_LOCATION, fb_loc);
845 else 855 else
@@ -850,6 +860,8 @@ static void radeon_write_agp_location(drm_radeon_private_t *dev_priv, u32 agp_lo
850{ 860{
851 if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) 861 if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515)
852 RADEON_WRITE_MCIND(RV515_MC_AGP_LOCATION, agp_loc); 862 RADEON_WRITE_MCIND(RV515_MC_AGP_LOCATION, agp_loc);
863 else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690)
864 RS690_WRITE_MCIND(RS690_MC_AGP_LOCATION, agp_loc);
853 else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515) 865 else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515)
854 RADEON_WRITE_MCIND(R520_MC_AGP_LOCATION, agp_loc); 866 RADEON_WRITE_MCIND(R520_MC_AGP_LOCATION, agp_loc);
855 else 867 else
@@ -1362,6 +1374,70 @@ static void radeon_set_igpgart(drm_radeon_private_t * dev_priv, int on)
1362 } 1374 }
1363} 1375}
1364 1376
1377/* Enable or disable RS690 GART on the chip */
1378static void radeon_set_rs690gart(drm_radeon_private_t *dev_priv, int on)
1379{
1380 u32 temp;
1381
1382 if (on) {
1383 DRM_DEBUG("programming rs690 gart %08X %08lX %08X\n",
1384 dev_priv->gart_vm_start,
1385 (long)dev_priv->gart_info.bus_addr,
1386 dev_priv->gart_size);
1387
1388 temp = RS690_READ_MCIND(dev_priv, RS690_MC_MISC_CNTL);
1389 RS690_WRITE_MCIND(RS690_MC_MISC_CNTL, 0x5000);
1390
1391 RS690_WRITE_MCIND(RS690_MC_AGP_SIZE,
1392 RS690_MC_GART_EN | RS690_MC_AGP_SIZE_32MB);
1393
1394 temp = RS690_READ_MCIND(dev_priv, RS690_MC_GART_FEATURE_ID);
1395 RS690_WRITE_MCIND(RS690_MC_GART_FEATURE_ID, 0x42040800);
1396
1397 RS690_WRITE_MCIND(RS690_MC_GART_BASE,
1398 dev_priv->gart_info.bus_addr);
1399
1400 temp = RS690_READ_MCIND(dev_priv, RS690_MC_AGP_MODE_CONTROL);
1401 RS690_WRITE_MCIND(RS690_MC_AGP_MODE_CONTROL, 0x01400000);
1402
1403 RS690_WRITE_MCIND(RS690_MC_AGP_BASE,
1404 (unsigned int)dev_priv->gart_vm_start);
1405
1406 dev_priv->gart_size = 32*1024*1024;
1407 temp = (((dev_priv->gart_vm_start - 1 + dev_priv->gart_size) &
1408 0xffff0000) | (dev_priv->gart_vm_start >> 16));
1409
1410 RS690_WRITE_MCIND(RS690_MC_AGP_LOCATION, temp);
1411
1412 temp = RS690_READ_MCIND(dev_priv, RS690_MC_AGP_SIZE);
1413 RS690_WRITE_MCIND(RS690_MC_AGP_SIZE,
1414 RS690_MC_GART_EN | RS690_MC_AGP_SIZE_32MB);
1415
1416 do {
1417 temp = RS690_READ_MCIND(dev_priv, RS690_MC_GART_CACHE_CNTL);
1418 if ((temp & RS690_MC_GART_CLEAR_STATUS) ==
1419 RS690_MC_GART_CLEAR_DONE)
1420 break;
1421 DRM_UDELAY(1);
1422 } while (1);
1423
1424 RS690_WRITE_MCIND(RS690_MC_GART_CACHE_CNTL,
1425 RS690_MC_GART_CC_CLEAR);
1426 do {
1427 temp = RS690_READ_MCIND(dev_priv, RS690_MC_GART_CACHE_CNTL);
1428 if ((temp & RS690_MC_GART_CLEAR_STATUS) ==
1429 RS690_MC_GART_CLEAR_DONE)
1430 break;
1431 DRM_UDELAY(1);
1432 } while (1);
1433
1434 RS690_WRITE_MCIND(RS690_MC_GART_CACHE_CNTL,
1435 RS690_MC_GART_CC_NO_CHANGE);
1436 } else {
1437 RS690_WRITE_MCIND(RS690_MC_AGP_SIZE, RS690_MC_GART_DIS);
1438 }
1439}
1440
1365static void radeon_set_pciegart(drm_radeon_private_t * dev_priv, int on) 1441static void radeon_set_pciegart(drm_radeon_private_t * dev_priv, int on)
1366{ 1442{
1367 u32 tmp = RADEON_READ_PCIE(dev_priv, RADEON_PCIE_TX_GART_CNTL); 1443 u32 tmp = RADEON_READ_PCIE(dev_priv, RADEON_PCIE_TX_GART_CNTL);
@@ -1396,6 +1472,11 @@ static void radeon_set_pcigart(drm_radeon_private_t * dev_priv, int on)
1396{ 1472{
1397 u32 tmp; 1473 u32 tmp;
1398 1474
1475 if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) {
1476 radeon_set_rs690gart(dev_priv, on);
1477 return;
1478 }
1479
1399 if (dev_priv->flags & RADEON_IS_IGPGART) { 1480 if (dev_priv->flags & RADEON_IS_IGPGART) {
1400 radeon_set_igpgart(dev_priv, on); 1481 radeon_set_igpgart(dev_priv, on);
1401 return; 1482 return;