diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2016-04-08 00:19:39 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-05-04 20:22:36 -0400 |
commit | ce22362b79acd5483082cab477db288925aac51f (patch) | |
tree | eda2413423e4c8fd417d0dbc2b2b0535161c9683 /drivers/gpu | |
parent | b6711d1b88fea8ea663172d1d0d6721f48a846bf (diff) |
drm/amdgpu/sdma: rename fiji cg functions
They care common for all sdma 3.0 parts
Acked-by: Tom St Denis <tom.stdenis@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 104 |
1 files changed, 39 insertions, 65 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c index 739365da0649..dc29a20b935b 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | |||
@@ -1458,40 +1458,31 @@ static int sdma_v3_0_process_illegal_inst_irq(struct amdgpu_device *adev, | |||
1458 | return 0; | 1458 | return 0; |
1459 | } | 1459 | } |
1460 | 1460 | ||
1461 | static void fiji_update_sdma_medium_grain_clock_gating( | 1461 | static void sdma_v3_0_update_sdma_medium_grain_clock_gating( |
1462 | struct amdgpu_device *adev, | 1462 | struct amdgpu_device *adev, |
1463 | bool enable) | 1463 | bool enable) |
1464 | { | 1464 | { |
1465 | uint32_t temp, data; | 1465 | uint32_t temp, data; |
1466 | int i; | ||
1466 | 1467 | ||
1467 | if (enable && (adev->cg_flags & AMD_CG_SUPPORT_SDMA_MGCG)) { | 1468 | if (enable && (adev->cg_flags & AMD_CG_SUPPORT_SDMA_MGCG)) { |
1468 | temp = data = RREG32(mmSDMA0_CLK_CTRL); | 1469 | for (i = 0; i < adev->sdma.num_instances; i++) { |
1469 | data &= ~(SDMA0_CLK_CTRL__SOFT_OVERRIDE7_MASK | | 1470 | temp = data = RREG32(mmSDMA0_CLK_CTRL + sdma_offsets[i]); |
1470 | SDMA0_CLK_CTRL__SOFT_OVERRIDE6_MASK | | 1471 | data &= ~(SDMA0_CLK_CTRL__SOFT_OVERRIDE7_MASK | |
1471 | SDMA0_CLK_CTRL__SOFT_OVERRIDE5_MASK | | 1472 | SDMA0_CLK_CTRL__SOFT_OVERRIDE6_MASK | |
1472 | SDMA0_CLK_CTRL__SOFT_OVERRIDE4_MASK | | 1473 | SDMA0_CLK_CTRL__SOFT_OVERRIDE5_MASK | |
1473 | SDMA0_CLK_CTRL__SOFT_OVERRIDE3_MASK | | 1474 | SDMA0_CLK_CTRL__SOFT_OVERRIDE4_MASK | |
1474 | SDMA0_CLK_CTRL__SOFT_OVERRIDE2_MASK | | 1475 | SDMA0_CLK_CTRL__SOFT_OVERRIDE3_MASK | |
1475 | SDMA0_CLK_CTRL__SOFT_OVERRIDE1_MASK | | 1476 | SDMA0_CLK_CTRL__SOFT_OVERRIDE2_MASK | |
1476 | SDMA0_CLK_CTRL__SOFT_OVERRIDE0_MASK); | 1477 | SDMA0_CLK_CTRL__SOFT_OVERRIDE1_MASK | |
1477 | if (data != temp) | 1478 | SDMA0_CLK_CTRL__SOFT_OVERRIDE0_MASK); |
1478 | WREG32(mmSDMA0_CLK_CTRL, data); | 1479 | if (data != temp) |
1479 | 1480 | WREG32(mmSDMA0_CLK_CTRL + sdma_offsets[i], data); | |
1480 | temp = data = RREG32(mmSDMA1_CLK_CTRL); | 1481 | } |
1481 | data &= ~(SDMA1_CLK_CTRL__SOFT_OVERRIDE7_MASK | | ||
1482 | SDMA1_CLK_CTRL__SOFT_OVERRIDE6_MASK | | ||
1483 | SDMA1_CLK_CTRL__SOFT_OVERRIDE5_MASK | | ||
1484 | SDMA1_CLK_CTRL__SOFT_OVERRIDE4_MASK | | ||
1485 | SDMA1_CLK_CTRL__SOFT_OVERRIDE3_MASK | | ||
1486 | SDMA1_CLK_CTRL__SOFT_OVERRIDE2_MASK | | ||
1487 | SDMA1_CLK_CTRL__SOFT_OVERRIDE1_MASK | | ||
1488 | SDMA1_CLK_CTRL__SOFT_OVERRIDE0_MASK); | ||
1489 | |||
1490 | if (data != temp) | ||
1491 | WREG32(mmSDMA1_CLK_CTRL, data); | ||
1492 | } else { | 1482 | } else { |
1493 | temp = data = RREG32(mmSDMA0_CLK_CTRL); | 1483 | for (i = 0; i < adev->sdma.num_instances; i++) { |
1494 | data |= SDMA0_CLK_CTRL__SOFT_OVERRIDE7_MASK | | 1484 | temp = data = RREG32(mmSDMA0_CLK_CTRL + sdma_offsets[i]); |
1485 | data |= SDMA0_CLK_CTRL__SOFT_OVERRIDE7_MASK | | ||
1495 | SDMA0_CLK_CTRL__SOFT_OVERRIDE6_MASK | | 1486 | SDMA0_CLK_CTRL__SOFT_OVERRIDE6_MASK | |
1496 | SDMA0_CLK_CTRL__SOFT_OVERRIDE5_MASK | | 1487 | SDMA0_CLK_CTRL__SOFT_OVERRIDE5_MASK | |
1497 | SDMA0_CLK_CTRL__SOFT_OVERRIDE4_MASK | | 1488 | SDMA0_CLK_CTRL__SOFT_OVERRIDE4_MASK | |
@@ -1500,54 +1491,35 @@ static void fiji_update_sdma_medium_grain_clock_gating( | |||
1500 | SDMA0_CLK_CTRL__SOFT_OVERRIDE1_MASK | | 1491 | SDMA0_CLK_CTRL__SOFT_OVERRIDE1_MASK | |
1501 | SDMA0_CLK_CTRL__SOFT_OVERRIDE0_MASK; | 1492 | SDMA0_CLK_CTRL__SOFT_OVERRIDE0_MASK; |
1502 | 1493 | ||
1503 | if (data != temp) | 1494 | if (data != temp) |
1504 | WREG32(mmSDMA0_CLK_CTRL, data); | 1495 | WREG32(mmSDMA0_CLK_CTRL + sdma_offsets[i], data); |
1505 | 1496 | } | |
1506 | temp = data = RREG32(mmSDMA1_CLK_CTRL); | ||
1507 | data |= SDMA1_CLK_CTRL__SOFT_OVERRIDE7_MASK | | ||
1508 | SDMA1_CLK_CTRL__SOFT_OVERRIDE6_MASK | | ||
1509 | SDMA1_CLK_CTRL__SOFT_OVERRIDE5_MASK | | ||
1510 | SDMA1_CLK_CTRL__SOFT_OVERRIDE4_MASK | | ||
1511 | SDMA1_CLK_CTRL__SOFT_OVERRIDE3_MASK | | ||
1512 | SDMA1_CLK_CTRL__SOFT_OVERRIDE2_MASK | | ||
1513 | SDMA1_CLK_CTRL__SOFT_OVERRIDE1_MASK | | ||
1514 | SDMA1_CLK_CTRL__SOFT_OVERRIDE0_MASK; | ||
1515 | |||
1516 | if (data != temp) | ||
1517 | WREG32(mmSDMA1_CLK_CTRL, data); | ||
1518 | } | 1497 | } |
1519 | } | 1498 | } |
1520 | 1499 | ||
1521 | static void fiji_update_sdma_medium_grain_light_sleep( | 1500 | static void sdma_v3_0_update_sdma_medium_grain_light_sleep( |
1522 | struct amdgpu_device *adev, | 1501 | struct amdgpu_device *adev, |
1523 | bool enable) | 1502 | bool enable) |
1524 | { | 1503 | { |
1525 | uint32_t temp, data; | 1504 | uint32_t temp, data; |
1505 | int i; | ||
1526 | 1506 | ||
1527 | if (enable && (adev->cg_flags & AMD_CG_SUPPORT_SDMA_LS)) { | 1507 | if (enable && (adev->cg_flags & AMD_CG_SUPPORT_SDMA_LS)) { |
1528 | temp = data = RREG32(mmSDMA0_POWER_CNTL); | 1508 | for (i = 0; i < adev->sdma.num_instances; i++) { |
1529 | data |= SDMA0_POWER_CNTL__MEM_POWER_OVERRIDE_MASK; | 1509 | temp = data = RREG32(mmSDMA0_POWER_CNTL + sdma_offsets[i]); |
1530 | 1510 | data |= SDMA0_POWER_CNTL__MEM_POWER_OVERRIDE_MASK; | |
1531 | if (temp != data) | ||
1532 | WREG32(mmSDMA0_POWER_CNTL, data); | ||
1533 | |||
1534 | temp = data = RREG32(mmSDMA1_POWER_CNTL); | ||
1535 | data |= SDMA1_POWER_CNTL__MEM_POWER_OVERRIDE_MASK; | ||
1536 | 1511 | ||
1537 | if (temp != data) | 1512 | if (temp != data) |
1538 | WREG32(mmSDMA1_POWER_CNTL, data); | 1513 | WREG32(mmSDMA0_POWER_CNTL + sdma_offsets[i], data); |
1514 | } | ||
1539 | } else { | 1515 | } else { |
1540 | temp = data = RREG32(mmSDMA0_POWER_CNTL); | 1516 | for (i = 0; i < adev->sdma.num_instances; i++) { |
1541 | data &= ~SDMA0_POWER_CNTL__MEM_POWER_OVERRIDE_MASK; | 1517 | temp = data = RREG32(mmSDMA0_POWER_CNTL + sdma_offsets[i]); |
1542 | 1518 | data &= ~SDMA0_POWER_CNTL__MEM_POWER_OVERRIDE_MASK; | |
1543 | if (temp != data) | ||
1544 | WREG32(mmSDMA0_POWER_CNTL, data); | ||
1545 | |||
1546 | temp = data = RREG32(mmSDMA1_POWER_CNTL); | ||
1547 | data &= ~SDMA1_POWER_CNTL__MEM_POWER_OVERRIDE_MASK; | ||
1548 | 1519 | ||
1549 | if (temp != data) | 1520 | if (temp != data) |
1550 | WREG32(mmSDMA1_POWER_CNTL, data); | 1521 | WREG32(mmSDMA0_POWER_CNTL + sdma_offsets[i], data); |
1522 | } | ||
1551 | } | 1523 | } |
1552 | } | 1524 | } |
1553 | 1525 | ||
@@ -1558,9 +1530,11 @@ static int sdma_v3_0_set_clockgating_state(void *handle, | |||
1558 | 1530 | ||
1559 | switch (adev->asic_type) { | 1531 | switch (adev->asic_type) { |
1560 | case CHIP_FIJI: | 1532 | case CHIP_FIJI: |
1561 | fiji_update_sdma_medium_grain_clock_gating(adev, | 1533 | case CHIP_CARRIZO: |
1534 | case CHIP_STONEY: | ||
1535 | sdma_v3_0_update_sdma_medium_grain_clock_gating(adev, | ||
1562 | state == AMD_CG_STATE_GATE ? true : false); | 1536 | state == AMD_CG_STATE_GATE ? true : false); |
1563 | fiji_update_sdma_medium_grain_light_sleep(adev, | 1537 | sdma_v3_0_update_sdma_medium_grain_light_sleep(adev, |
1564 | state == AMD_CG_STATE_GATE ? true : false); | 1538 | state == AMD_CG_STATE_GATE ? true : false); |
1565 | break; | 1539 | break; |
1566 | default: | 1540 | default: |