aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/cik.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/radeon/cik.c')
-rw-r--r--drivers/gpu/drm/radeon/cik.c148
1 files changed, 148 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
index a5181404f130..69a00d64716e 100644
--- a/drivers/gpu/drm/radeon/cik.c
+++ b/drivers/gpu/drm/radeon/cik.c
@@ -63,6 +63,12 @@ MODULE_FIRMWARE("radeon/KABINI_ce.bin");
63MODULE_FIRMWARE("radeon/KABINI_mec.bin"); 63MODULE_FIRMWARE("radeon/KABINI_mec.bin");
64MODULE_FIRMWARE("radeon/KABINI_rlc.bin"); 64MODULE_FIRMWARE("radeon/KABINI_rlc.bin");
65MODULE_FIRMWARE("radeon/KABINI_sdma.bin"); 65MODULE_FIRMWARE("radeon/KABINI_sdma.bin");
66MODULE_FIRMWARE("radeon/MULLINS_pfp.bin");
67MODULE_FIRMWARE("radeon/MULLINS_me.bin");
68MODULE_FIRMWARE("radeon/MULLINS_ce.bin");
69MODULE_FIRMWARE("radeon/MULLINS_mec.bin");
70MODULE_FIRMWARE("radeon/MULLINS_rlc.bin");
71MODULE_FIRMWARE("radeon/MULLINS_sdma.bin");
66 72
67extern int r600_ih_ring_alloc(struct radeon_device *rdev); 73extern int r600_ih_ring_alloc(struct radeon_device *rdev);
68extern void r600_ih_ring_fini(struct radeon_device *rdev); 74extern void r600_ih_ring_fini(struct radeon_device *rdev);
@@ -1473,6 +1479,43 @@ static const u32 hawaii_mgcg_cgcg_init[] =
1473 0xd80c, 0xff000ff0, 0x00000100 1479 0xd80c, 0xff000ff0, 0x00000100
1474}; 1480};
1475 1481
1482static const u32 godavari_golden_registers[] =
1483{
1484 0x55e4, 0xff607fff, 0xfc000100,
1485 0x6ed8, 0x00010101, 0x00010000,
1486 0x9830, 0xffffffff, 0x00000000,
1487 0x98302, 0xf00fffff, 0x00000400,
1488 0x6130, 0xffffffff, 0x00010000,
1489 0x5bb0, 0x000000f0, 0x00000070,
1490 0x5bc0, 0xf0311fff, 0x80300000,
1491 0x98f8, 0x73773777, 0x12010001,
1492 0x98fc, 0xffffffff, 0x00000010,
1493 0x8030, 0x00001f0f, 0x0000100a,
1494 0x2f48, 0x73773777, 0x12010001,
1495 0x2408, 0x000fffff, 0x000c007f,
1496 0x8a14, 0xf000003f, 0x00000007,
1497 0x8b24, 0xffffffff, 0x00ff0fff,
1498 0x30a04, 0x0000ff0f, 0x00000000,
1499 0x28a4c, 0x07ffffff, 0x06000000,
1500 0x4d8, 0x00000fff, 0x00000100,
1501 0xd014, 0x00010000, 0x00810001,
1502 0xd814, 0x00010000, 0x00810001,
1503 0x3e78, 0x00000001, 0x00000002,
1504 0xc768, 0x00000008, 0x00000008,
1505 0xc770, 0x00000f00, 0x00000800,
1506 0xc774, 0x00000f00, 0x00000800,
1507 0xc798, 0x00ffffff, 0x00ff7fbf,
1508 0xc79c, 0x00ffffff, 0x00ff7faf,
1509 0x8c00, 0x000000ff, 0x00000001,
1510 0x214f8, 0x01ff01ff, 0x00000002,
1511 0x21498, 0x007ff800, 0x00200000,
1512 0x2015c, 0xffffffff, 0x00000f40,
1513 0x88c4, 0x001f3ae3, 0x00000082,
1514 0x88d4, 0x0000001f, 0x00000010,
1515 0x30934, 0xffffffff, 0x00000000
1516};
1517
1518
1476static void cik_init_golden_registers(struct radeon_device *rdev) 1519static void cik_init_golden_registers(struct radeon_device *rdev)
1477{ 1520{
1478 switch (rdev->family) { 1521 switch (rdev->family) {
@@ -1504,6 +1547,20 @@ static void cik_init_golden_registers(struct radeon_device *rdev)
1504 kalindi_golden_spm_registers, 1547 kalindi_golden_spm_registers,
1505 (const u32)ARRAY_SIZE(kalindi_golden_spm_registers)); 1548 (const u32)ARRAY_SIZE(kalindi_golden_spm_registers));
1506 break; 1549 break;
1550 case CHIP_MULLINS:
1551 radeon_program_register_sequence(rdev,
1552 kalindi_mgcg_cgcg_init,
1553 (const u32)ARRAY_SIZE(kalindi_mgcg_cgcg_init));
1554 radeon_program_register_sequence(rdev,
1555 godavari_golden_registers,
1556 (const u32)ARRAY_SIZE(godavari_golden_registers));
1557 radeon_program_register_sequence(rdev,
1558 kalindi_golden_common_registers,
1559 (const u32)ARRAY_SIZE(kalindi_golden_common_registers));
1560 radeon_program_register_sequence(rdev,
1561 kalindi_golden_spm_registers,
1562 (const u32)ARRAY_SIZE(kalindi_golden_spm_registers));
1563 break;
1507 case CHIP_KAVERI: 1564 case CHIP_KAVERI:
1508 radeon_program_register_sequence(rdev, 1565 radeon_program_register_sequence(rdev,
1509 spectre_mgcg_cgcg_init, 1566 spectre_mgcg_cgcg_init,
@@ -1834,6 +1891,15 @@ static int cik_init_microcode(struct radeon_device *rdev)
1834 rlc_req_size = KB_RLC_UCODE_SIZE * 4; 1891 rlc_req_size = KB_RLC_UCODE_SIZE * 4;
1835 sdma_req_size = CIK_SDMA_UCODE_SIZE * 4; 1892 sdma_req_size = CIK_SDMA_UCODE_SIZE * 4;
1836 break; 1893 break;
1894 case CHIP_MULLINS:
1895 chip_name = "MULLINS";
1896 pfp_req_size = CIK_PFP_UCODE_SIZE * 4;
1897 me_req_size = CIK_ME_UCODE_SIZE * 4;
1898 ce_req_size = CIK_CE_UCODE_SIZE * 4;
1899 mec_req_size = CIK_MEC_UCODE_SIZE * 4;
1900 rlc_req_size = ML_RLC_UCODE_SIZE * 4;
1901 sdma_req_size = CIK_SDMA_UCODE_SIZE * 4;
1902 break;
1837 default: BUG(); 1903 default: BUG();
1838 } 1904 }
1839 1905
@@ -3272,6 +3338,7 @@ static void cik_gpu_init(struct radeon_device *rdev)
3272 gb_addr_config = BONAIRE_GB_ADDR_CONFIG_GOLDEN; 3338 gb_addr_config = BONAIRE_GB_ADDR_CONFIG_GOLDEN;
3273 break; 3339 break;
3274 case CHIP_KABINI: 3340 case CHIP_KABINI:
3341 case CHIP_MULLINS:
3275 default: 3342 default:
3276 rdev->config.cik.max_shader_engines = 1; 3343 rdev->config.cik.max_shader_engines = 1;
3277 rdev->config.cik.max_tile_pipes = 2; 3344 rdev->config.cik.max_tile_pipes = 2;
@@ -3702,6 +3769,7 @@ int cik_copy_cpdma(struct radeon_device *rdev,
3702 r = radeon_fence_emit(rdev, fence, ring->idx); 3769 r = radeon_fence_emit(rdev, fence, ring->idx);
3703 if (r) { 3770 if (r) {
3704 radeon_ring_unlock_undo(rdev, ring); 3771 radeon_ring_unlock_undo(rdev, ring);
3772 radeon_semaphore_free(rdev, &sem, NULL);
3705 return r; 3773 return r;
3706 } 3774 }
3707 3775
@@ -5803,6 +5871,9 @@ static int cik_rlc_resume(struct radeon_device *rdev)
5803 case CHIP_KABINI: 5871 case CHIP_KABINI:
5804 size = KB_RLC_UCODE_SIZE; 5872 size = KB_RLC_UCODE_SIZE;
5805 break; 5873 break;
5874 case CHIP_MULLINS:
5875 size = ML_RLC_UCODE_SIZE;
5876 break;
5806 } 5877 }
5807 5878
5808 cik_rlc_stop(rdev); 5879 cik_rlc_stop(rdev);
@@ -6551,6 +6622,7 @@ void cik_get_csb_buffer(struct radeon_device *rdev, volatile u32 *buffer)
6551 buffer[count++] = cpu_to_le32(0x00000000); 6622 buffer[count++] = cpu_to_le32(0x00000000);
6552 break; 6623 break;
6553 case CHIP_KABINI: 6624 case CHIP_KABINI:
6625 case CHIP_MULLINS:
6554 buffer[count++] = cpu_to_le32(0x00000000); /* XXX */ 6626 buffer[count++] = cpu_to_le32(0x00000000); /* XXX */
6555 buffer[count++] = cpu_to_le32(0x00000000); 6627 buffer[count++] = cpu_to_le32(0x00000000);
6556 break; 6628 break;
@@ -6696,6 +6768,19 @@ static void cik_disable_interrupt_state(struct radeon_device *rdev)
6696 WREG32(LB_INTERRUPT_MASK + EVERGREEN_CRTC4_REGISTER_OFFSET, 0); 6768 WREG32(LB_INTERRUPT_MASK + EVERGREEN_CRTC4_REGISTER_OFFSET, 0);
6697 WREG32(LB_INTERRUPT_MASK + EVERGREEN_CRTC5_REGISTER_OFFSET, 0); 6769 WREG32(LB_INTERRUPT_MASK + EVERGREEN_CRTC5_REGISTER_OFFSET, 0);
6698 } 6770 }
6771 /* pflip */
6772 if (rdev->num_crtc >= 2) {
6773 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET, 0);
6774 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET, 0);
6775 }
6776 if (rdev->num_crtc >= 4) {
6777 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET, 0);
6778 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET, 0);
6779 }
6780 if (rdev->num_crtc >= 6) {
6781 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET, 0);
6782 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, 0);
6783 }
6699 6784
6700 /* dac hotplug */ 6785 /* dac hotplug */
6701 WREG32(DAC_AUTODETECT_INT_CONTROL, 0); 6786 WREG32(DAC_AUTODETECT_INT_CONTROL, 0);
@@ -7052,6 +7137,25 @@ int cik_irq_set(struct radeon_device *rdev)
7052 WREG32(LB_INTERRUPT_MASK + EVERGREEN_CRTC5_REGISTER_OFFSET, crtc6); 7137 WREG32(LB_INTERRUPT_MASK + EVERGREEN_CRTC5_REGISTER_OFFSET, crtc6);
7053 } 7138 }
7054 7139
7140 if (rdev->num_crtc >= 2) {
7141 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET,
7142 GRPH_PFLIP_INT_MASK);
7143 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET,
7144 GRPH_PFLIP_INT_MASK);
7145 }
7146 if (rdev->num_crtc >= 4) {
7147 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET,
7148 GRPH_PFLIP_INT_MASK);
7149 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET,
7150 GRPH_PFLIP_INT_MASK);
7151 }
7152 if (rdev->num_crtc >= 6) {
7153 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET,
7154 GRPH_PFLIP_INT_MASK);
7155 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET,
7156 GRPH_PFLIP_INT_MASK);
7157 }
7158
7055 WREG32(DC_HPD1_INT_CONTROL, hpd1); 7159 WREG32(DC_HPD1_INT_CONTROL, hpd1);
7056 WREG32(DC_HPD2_INT_CONTROL, hpd2); 7160 WREG32(DC_HPD2_INT_CONTROL, hpd2);
7057 WREG32(DC_HPD3_INT_CONTROL, hpd3); 7161 WREG32(DC_HPD3_INT_CONTROL, hpd3);
@@ -7088,6 +7192,29 @@ static inline void cik_irq_ack(struct radeon_device *rdev)
7088 rdev->irq.stat_regs.cik.disp_int_cont5 = RREG32(DISP_INTERRUPT_STATUS_CONTINUE5); 7192 rdev->irq.stat_regs.cik.disp_int_cont5 = RREG32(DISP_INTERRUPT_STATUS_CONTINUE5);
7089 rdev->irq.stat_regs.cik.disp_int_cont6 = RREG32(DISP_INTERRUPT_STATUS_CONTINUE6); 7193 rdev->irq.stat_regs.cik.disp_int_cont6 = RREG32(DISP_INTERRUPT_STATUS_CONTINUE6);
7090 7194
7195 rdev->irq.stat_regs.cik.d1grph_int = RREG32(GRPH_INT_STATUS +
7196 EVERGREEN_CRTC0_REGISTER_OFFSET);
7197 rdev->irq.stat_regs.cik.d2grph_int = RREG32(GRPH_INT_STATUS +
7198 EVERGREEN_CRTC1_REGISTER_OFFSET);
7199 if (rdev->num_crtc >= 4) {
7200 rdev->irq.stat_regs.cik.d3grph_int = RREG32(GRPH_INT_STATUS +
7201 EVERGREEN_CRTC2_REGISTER_OFFSET);
7202 rdev->irq.stat_regs.cik.d4grph_int = RREG32(GRPH_INT_STATUS +
7203 EVERGREEN_CRTC3_REGISTER_OFFSET);
7204 }
7205 if (rdev->num_crtc >= 6) {
7206 rdev->irq.stat_regs.cik.d5grph_int = RREG32(GRPH_INT_STATUS +
7207 EVERGREEN_CRTC4_REGISTER_OFFSET);
7208 rdev->irq.stat_regs.cik.d6grph_int = RREG32(GRPH_INT_STATUS +
7209 EVERGREEN_CRTC5_REGISTER_OFFSET);
7210 }
7211
7212 if (rdev->irq.stat_regs.cik.d1grph_int & GRPH_PFLIP_INT_OCCURRED)
7213 WREG32(GRPH_INT_STATUS + EVERGREEN_CRTC0_REGISTER_OFFSET,
7214 GRPH_PFLIP_INT_CLEAR);
7215 if (rdev->irq.stat_regs.cik.d2grph_int & GRPH_PFLIP_INT_OCCURRED)
7216 WREG32(GRPH_INT_STATUS + EVERGREEN_CRTC1_REGISTER_OFFSET,
7217 GRPH_PFLIP_INT_CLEAR);
7091 if (rdev->irq.stat_regs.cik.disp_int & LB_D1_VBLANK_INTERRUPT) 7218 if (rdev->irq.stat_regs.cik.disp_int & LB_D1_VBLANK_INTERRUPT)
7092 WREG32(LB_VBLANK_STATUS + EVERGREEN_CRTC0_REGISTER_OFFSET, VBLANK_ACK); 7219 WREG32(LB_VBLANK_STATUS + EVERGREEN_CRTC0_REGISTER_OFFSET, VBLANK_ACK);
7093 if (rdev->irq.stat_regs.cik.disp_int & LB_D1_VLINE_INTERRUPT) 7220 if (rdev->irq.stat_regs.cik.disp_int & LB_D1_VLINE_INTERRUPT)
@@ -7098,6 +7225,12 @@ static inline void cik_irq_ack(struct radeon_device *rdev)
7098 WREG32(LB_VLINE_STATUS + EVERGREEN_CRTC1_REGISTER_OFFSET, VLINE_ACK); 7225 WREG32(LB_VLINE_STATUS + EVERGREEN_CRTC1_REGISTER_OFFSET, VLINE_ACK);
7099 7226
7100 if (rdev->num_crtc >= 4) { 7227 if (rdev->num_crtc >= 4) {
7228 if (rdev->irq.stat_regs.cik.d3grph_int & GRPH_PFLIP_INT_OCCURRED)
7229 WREG32(GRPH_INT_STATUS + EVERGREEN_CRTC2_REGISTER_OFFSET,
7230 GRPH_PFLIP_INT_CLEAR);
7231 if (rdev->irq.stat_regs.cik.d4grph_int & GRPH_PFLIP_INT_OCCURRED)
7232 WREG32(GRPH_INT_STATUS + EVERGREEN_CRTC3_REGISTER_OFFSET,
7233 GRPH_PFLIP_INT_CLEAR);
7101 if (rdev->irq.stat_regs.cik.disp_int_cont2 & LB_D3_VBLANK_INTERRUPT) 7234 if (rdev->irq.stat_regs.cik.disp_int_cont2 & LB_D3_VBLANK_INTERRUPT)
7102 WREG32(LB_VBLANK_STATUS + EVERGREEN_CRTC2_REGISTER_OFFSET, VBLANK_ACK); 7235 WREG32(LB_VBLANK_STATUS + EVERGREEN_CRTC2_REGISTER_OFFSET, VBLANK_ACK);
7103 if (rdev->irq.stat_regs.cik.disp_int_cont2 & LB_D3_VLINE_INTERRUPT) 7236 if (rdev->irq.stat_regs.cik.disp_int_cont2 & LB_D3_VLINE_INTERRUPT)
@@ -7109,6 +7242,12 @@ static inline void cik_irq_ack(struct radeon_device *rdev)
7109 } 7242 }
7110 7243
7111 if (rdev->num_crtc >= 6) { 7244 if (rdev->num_crtc >= 6) {
7245 if (rdev->irq.stat_regs.cik.d5grph_int & GRPH_PFLIP_INT_OCCURRED)
7246 WREG32(GRPH_INT_STATUS + EVERGREEN_CRTC4_REGISTER_OFFSET,
7247 GRPH_PFLIP_INT_CLEAR);
7248 if (rdev->irq.stat_regs.cik.d6grph_int & GRPH_PFLIP_INT_OCCURRED)
7249 WREG32(GRPH_INT_STATUS + EVERGREEN_CRTC5_REGISTER_OFFSET,
7250 GRPH_PFLIP_INT_CLEAR);
7112 if (rdev->irq.stat_regs.cik.disp_int_cont4 & LB_D5_VBLANK_INTERRUPT) 7251 if (rdev->irq.stat_regs.cik.disp_int_cont4 & LB_D5_VBLANK_INTERRUPT)
7113 WREG32(LB_VBLANK_STATUS + EVERGREEN_CRTC4_REGISTER_OFFSET, VBLANK_ACK); 7252 WREG32(LB_VBLANK_STATUS + EVERGREEN_CRTC4_REGISTER_OFFSET, VBLANK_ACK);
7114 if (rdev->irq.stat_regs.cik.disp_int_cont4 & LB_D5_VLINE_INTERRUPT) 7253 if (rdev->irq.stat_regs.cik.disp_int_cont4 & LB_D5_VLINE_INTERRUPT)
@@ -7460,6 +7599,15 @@ restart_ih:
7460 break; 7599 break;
7461 } 7600 }
7462 break; 7601 break;
7602 case 8: /* D1 page flip */
7603 case 10: /* D2 page flip */
7604 case 12: /* D3 page flip */
7605 case 14: /* D4 page flip */
7606 case 16: /* D5 page flip */
7607 case 18: /* D6 page flip */
7608 DRM_DEBUG("IH: D%d flip\n", ((src_id - 8) >> 1) + 1);
7609 radeon_crtc_handle_flip(rdev, (src_id - 8) >> 1);
7610 break;
7463 case 42: /* HPD hotplug */ 7611 case 42: /* HPD hotplug */
7464 switch (src_data) { 7612 switch (src_data) {
7465 case 0: 7613 case 0: