@@ -429,7 +429,7 @@ static int a6xx_rpmh_start(struct a6xx_gmu *gmu)
429
429
return ret ;
430
430
}
431
431
432
- ret = gmu_poll_timeout (gmu , REG_A6XX_RSCC_SEQ_BUSY_DRV0 , val ,
432
+ ret = gmu_poll_timeout_rscc (gmu , REG_A6XX_RSCC_SEQ_BUSY_DRV0 , val ,
433
433
!val , 100 , 10000 );
434
434
435
435
if (ret ) {
@@ -455,7 +455,7 @@ static void a6xx_rpmh_stop(struct a6xx_gmu *gmu)
455
455
456
456
gmu_write (gmu , REG_A6XX_GMU_RSCC_CONTROL_REQ , 1 );
457
457
458
- ret = gmu_poll_timeout (gmu , REG_A6XX_GPU_RSCC_RSC_STATUS0_DRV0 ,
458
+ ret = gmu_poll_timeout_rscc (gmu , REG_A6XX_GPU_RSCC_RSC_STATUS0_DRV0 ,
459
459
val , val & (1 << 16 ), 100 , 10000 );
460
460
if (ret )
461
461
DRM_DEV_ERROR (gmu -> dev , "Unable to power off the GPU RSC\n" );
@@ -478,32 +478,48 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)
478
478
struct platform_device * pdev = to_platform_device (gmu -> dev );
479
479
void __iomem * pdcptr = a6xx_gmu_get_mmio (pdev , "gmu_pdc" );
480
480
void __iomem * seqptr = a6xx_gmu_get_mmio (pdev , "gmu_pdc_seq" );
481
+ uint32_t pdc_address_offset ;
481
482
482
483
if (!pdcptr || !seqptr )
483
484
goto err ;
484
485
486
+ if (adreno_is_a618 (adreno_gpu ) || adreno_is_a640 (adreno_gpu ))
487
+ pdc_address_offset = 0x30090 ;
488
+ else if (adreno_is_a650 (adreno_gpu ))
489
+ pdc_address_offset = 0x300a0 ;
490
+ else
491
+ pdc_address_offset = 0x30080 ;
492
+
485
493
/* Disable SDE clock gating */
486
- gmu_write (gmu , REG_A6XX_GPU_RSCC_RSC_STATUS0_DRV0 , BIT (24 ));
494
+ gmu_write_rscc (gmu , REG_A6XX_GPU_RSCC_RSC_STATUS0_DRV0 , BIT (24 ));
487
495
488
496
/* Setup RSC PDC handshake for sleep and wakeup */
489
- gmu_write (gmu , REG_A6XX_RSCC_PDC_SLAVE_ID_DRV0 , 1 );
490
- gmu_write (gmu , REG_A6XX_RSCC_HIDDEN_TCS_CMD0_DATA , 0 );
491
- gmu_write (gmu , REG_A6XX_RSCC_HIDDEN_TCS_CMD0_ADDR , 0 );
492
- gmu_write (gmu , REG_A6XX_RSCC_HIDDEN_TCS_CMD0_DATA + 2 , 0 );
493
- gmu_write (gmu , REG_A6XX_RSCC_HIDDEN_TCS_CMD0_ADDR + 2 , 0 );
494
- gmu_write (gmu , REG_A6XX_RSCC_HIDDEN_TCS_CMD0_DATA + 4 , 0x80000000 );
495
- gmu_write (gmu , REG_A6XX_RSCC_HIDDEN_TCS_CMD0_ADDR + 4 , 0 );
496
- gmu_write (gmu , REG_A6XX_RSCC_OVERRIDE_START_ADDR , 0 );
497
- gmu_write (gmu , REG_A6XX_RSCC_PDC_SEQ_START_ADDR , 0x4520 );
498
- gmu_write (gmu , REG_A6XX_RSCC_PDC_MATCH_VALUE_LO , 0x4510 );
499
- gmu_write (gmu , REG_A6XX_RSCC_PDC_MATCH_VALUE_HI , 0x4514 );
497
+ gmu_write_rscc (gmu , REG_A6XX_RSCC_PDC_SLAVE_ID_DRV0 , 1 );
498
+ gmu_write_rscc (gmu , REG_A6XX_RSCC_HIDDEN_TCS_CMD0_DATA , 0 );
499
+ gmu_write_rscc (gmu , REG_A6XX_RSCC_HIDDEN_TCS_CMD0_ADDR , 0 );
500
+ gmu_write_rscc (gmu , REG_A6XX_RSCC_HIDDEN_TCS_CMD0_DATA + 2 , 0 );
501
+ gmu_write_rscc (gmu , REG_A6XX_RSCC_HIDDEN_TCS_CMD0_ADDR + 2 , 0 );
502
+ gmu_write_rscc (gmu , REG_A6XX_RSCC_HIDDEN_TCS_CMD0_DATA + 4 , 0x80000000 );
503
+ gmu_write_rscc (gmu , REG_A6XX_RSCC_HIDDEN_TCS_CMD0_ADDR + 4 , 0 );
504
+ gmu_write_rscc (gmu , REG_A6XX_RSCC_OVERRIDE_START_ADDR , 0 );
505
+ gmu_write_rscc (gmu , REG_A6XX_RSCC_PDC_SEQ_START_ADDR , 0x4520 );
506
+ gmu_write_rscc (gmu , REG_A6XX_RSCC_PDC_MATCH_VALUE_LO , 0x4510 );
507
+ gmu_write_rscc (gmu , REG_A6XX_RSCC_PDC_MATCH_VALUE_HI , 0x4514 );
500
508
501
509
/* Load RSC sequencer uCode for sleep and wakeup */
502
- gmu_write (gmu , REG_A6XX_RSCC_SEQ_MEM_0_DRV0 , 0xa7a506a0 );
503
- gmu_write (gmu , REG_A6XX_RSCC_SEQ_MEM_0_DRV0 + 1 , 0xa1e6a6e7 );
504
- gmu_write (gmu , REG_A6XX_RSCC_SEQ_MEM_0_DRV0 + 2 , 0xa2e081e1 );
505
- gmu_write (gmu , REG_A6XX_RSCC_SEQ_MEM_0_DRV0 + 3 , 0xe9a982e2 );
506
- gmu_write (gmu , REG_A6XX_RSCC_SEQ_MEM_0_DRV0 + 4 , 0x0020e8a8 );
510
+ if (adreno_is_a650 (adreno_gpu )) {
511
+ gmu_write_rscc (gmu , REG_A6XX_RSCC_SEQ_MEM_0_DRV0 , 0xeaaae5a0 );
512
+ gmu_write_rscc (gmu , REG_A6XX_RSCC_SEQ_MEM_0_DRV0 + 1 , 0xe1a1ebab );
513
+ gmu_write_rscc (gmu , REG_A6XX_RSCC_SEQ_MEM_0_DRV0 + 2 , 0xa2e0a581 );
514
+ gmu_write_rscc (gmu , REG_A6XX_RSCC_SEQ_MEM_0_DRV0 + 3 , 0xecac82e2 );
515
+ gmu_write_rscc (gmu , REG_A6XX_RSCC_SEQ_MEM_0_DRV0 + 4 , 0x0020edad );
516
+ } else {
517
+ gmu_write_rscc (gmu , REG_A6XX_RSCC_SEQ_MEM_0_DRV0 , 0xa7a506a0 );
518
+ gmu_write_rscc (gmu , REG_A6XX_RSCC_SEQ_MEM_0_DRV0 + 1 , 0xa1e6a6e7 );
519
+ gmu_write_rscc (gmu , REG_A6XX_RSCC_SEQ_MEM_0_DRV0 + 2 , 0xa2e081e1 );
520
+ gmu_write_rscc (gmu , REG_A6XX_RSCC_SEQ_MEM_0_DRV0 + 3 , 0xe9a982e2 );
521
+ gmu_write_rscc (gmu , REG_A6XX_RSCC_SEQ_MEM_0_DRV0 + 4 , 0x0020e8a8 );
522
+ }
507
523
508
524
/* Load PDC sequencer uCode for power up and power down sequence */
509
525
pdc_write (seqptr , REG_A6XX_PDC_GPU_SEQ_MEM_0 , 0xfebea1e1 );
@@ -524,10 +540,7 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)
524
540
pdc_write (pdcptr , REG_A6XX_PDC_GPU_TCS1_CMD0_DATA + 4 , 0x0 );
525
541
526
542
pdc_write (pdcptr , REG_A6XX_PDC_GPU_TCS1_CMD0_MSGID + 8 , 0x10108 );
527
- if (adreno_is_a618 (adreno_gpu ))
528
- pdc_write (pdcptr , REG_A6XX_PDC_GPU_TCS1_CMD0_ADDR + 8 , 0x30090 );
529
- else
530
- pdc_write (pdcptr , REG_A6XX_PDC_GPU_TCS1_CMD0_ADDR + 8 , 0x30080 );
543
+ pdc_write (pdcptr , REG_A6XX_PDC_GPU_TCS1_CMD0_ADDR + 8 , pdc_address_offset );
531
544
pdc_write (pdcptr , REG_A6XX_PDC_GPU_TCS1_CMD0_DATA + 8 , 0x0 );
532
545
533
546
pdc_write (pdcptr , REG_A6XX_PDC_GPU_TCS3_CMD_ENABLE_BANK , 7 );
@@ -539,17 +552,12 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)
539
552
540
553
pdc_write (pdcptr , REG_A6XX_PDC_GPU_TCS3_CMD0_MSGID + 4 , 0x10108 );
541
554
pdc_write (pdcptr , REG_A6XX_PDC_GPU_TCS3_CMD0_ADDR + 4 , 0x30000 );
542
- if (adreno_is_a618 (adreno_gpu ))
555
+ if (adreno_is_a618 (adreno_gpu ) || adreno_is_a650 ( adreno_gpu ) )
543
556
pdc_write (pdcptr , REG_A6XX_PDC_GPU_TCS3_CMD0_DATA + 4 , 0x2 );
544
557
else
545
558
pdc_write (pdcptr , REG_A6XX_PDC_GPU_TCS3_CMD0_DATA + 4 , 0x3 );
546
-
547
-
548
559
pdc_write (pdcptr , REG_A6XX_PDC_GPU_TCS3_CMD0_MSGID + 8 , 0x10108 );
549
- if (adreno_is_a618 (adreno_gpu ))
550
- pdc_write (pdcptr , REG_A6XX_PDC_GPU_TCS3_CMD0_ADDR + 8 , 0x30090 );
551
- else
552
- pdc_write (pdcptr , REG_A6XX_PDC_GPU_TCS3_CMD0_ADDR + 8 , 0x30080 );
560
+ pdc_write (pdcptr , REG_A6XX_PDC_GPU_TCS3_CMD0_ADDR + 8 , pdc_address_offset );
553
561
pdc_write (pdcptr , REG_A6XX_PDC_GPU_TCS3_CMD0_DATA + 8 , 0x3 );
554
562
555
563
/* Setup GPU PDC */
@@ -796,13 +804,13 @@ static void a6xx_gmu_rpmh_off(struct a6xx_gmu *gmu)
796
804
u32 val ;
797
805
798
806
/* Make sure there are no outstanding RPMh votes */
799
- gmu_poll_timeout (gmu , REG_A6XX_RSCC_TCS0_DRV0_STATUS , val ,
807
+ gmu_poll_timeout_rscc (gmu , REG_A6XX_RSCC_TCS0_DRV0_STATUS , val ,
800
808
(val & 1 ), 100 , 10000 );
801
- gmu_poll_timeout (gmu , REG_A6XX_RSCC_TCS1_DRV0_STATUS , val ,
809
+ gmu_poll_timeout_rscc (gmu , REG_A6XX_RSCC_TCS1_DRV0_STATUS , val ,
802
810
(val & 1 ), 100 , 10000 );
803
- gmu_poll_timeout (gmu , REG_A6XX_RSCC_TCS2_DRV0_STATUS , val ,
811
+ gmu_poll_timeout_rscc (gmu , REG_A6XX_RSCC_TCS2_DRV0_STATUS , val ,
804
812
(val & 1 ), 100 , 10000 );
805
- gmu_poll_timeout (gmu , REG_A6XX_RSCC_TCS3_DRV0_STATUS , val ,
813
+ gmu_poll_timeout_rscc (gmu , REG_A6XX_RSCC_TCS3_DRV0_STATUS , val ,
806
814
(val & 1 ), 100 , 1000 );
807
815
}
808
816
@@ -1361,6 +1369,7 @@ static int a6xx_gmu_get_irq(struct a6xx_gmu *gmu, struct platform_device *pdev,
1361
1369
void a6xx_gmu_remove (struct a6xx_gpu * a6xx_gpu )
1362
1370
{
1363
1371
struct a6xx_gmu * gmu = & a6xx_gpu -> gmu ;
1372
+ struct platform_device * pdev = to_platform_device (gmu -> dev );
1364
1373
1365
1374
if (!gmu -> initialized )
1366
1375
return ;
@@ -1373,7 +1382,10 @@ void a6xx_gmu_remove(struct a6xx_gpu *a6xx_gpu)
1373
1382
}
1374
1383
1375
1384
iounmap (gmu -> mmio );
1385
+ if (platform_get_resource_byname (pdev , IORESOURCE_MEM , "rscc" ))
1386
+ iounmap (gmu -> rscc );
1376
1387
gmu -> mmio = NULL ;
1388
+ gmu -> rscc = NULL ;
1377
1389
1378
1390
a6xx_gmu_memory_free (gmu );
1379
1391
@@ -1456,6 +1468,14 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node)
1456
1468
goto err_memory ;
1457
1469
}
1458
1470
1471
+ if (adreno_is_a650 (adreno_gpu )) {
1472
+ gmu -> rscc = a6xx_gmu_get_mmio (pdev , "rscc" );
1473
+ if (IS_ERR (gmu -> rscc ))
1474
+ goto err_mmio ;
1475
+ } else {
1476
+ gmu -> rscc = gmu -> mmio + 0x23000 ;
1477
+ }
1478
+
1459
1479
/* Get the HFI and GMU interrupts */
1460
1480
gmu -> hfi_irq = a6xx_gmu_get_irq (gmu , pdev , "hfi" , a6xx_hfi_irq );
1461
1481
gmu -> gmu_irq = a6xx_gmu_get_irq (gmu , pdev , "gmu" , a6xx_gmu_irq );
@@ -1481,6 +1501,8 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node)
1481
1501
1482
1502
err_mmio :
1483
1503
iounmap (gmu -> mmio );
1504
+ if (platform_get_resource_byname (pdev , IORESOURCE_MEM , "rscc" ))
1505
+ iounmap (gmu -> rscc );
1484
1506
free_irq (gmu -> gmu_irq , gmu );
1485
1507
free_irq (gmu -> hfi_irq , gmu );
1486
1508
0 commit comments