Move the one-time RPMh setup to a6xx_gmu_init(). To get rid of the hack for one-time init vs start, add in an extra a6xx_rpmh_stop() at the end of the init sequence.
Unified · Split
| @@ -621,6 +621,8 @@ setup_pdc: · 620 unmodified lines | |||
| 621 | /* ensure no writes happen before the uCode is fully written */ | 621 | /* ensure no writes happen before the uCode is fully written */ |
| 622 | wmb(); | 622 | wmb(); |
| 623 | 623 | ||
| 624 | a6xx_rpmh_stop(gmu); | ||
| 625 | |||
| 624 | err: | 626 | err: |
| 625 | if (!IS_ERR_OR_NULL(pdcptr)) | 627 | if (!IS_ERR_OR_NULL(pdcptr)) |
| 626 | iounmap(pdcptr); | 628 | iounmap(pdcptr); |
| @@ -753,7 +755,6 @@ static int a6xx_gmu_fw_load(struct a6xx_gmu *gmu) · 126 unmodified lines | |||
| 753 | 755 | ||
| 754 | static int a6xx_gmu_fw_start(struct a6xx_gmu *gmu, unsigned int state) | 756 | static int a6xx_gmu_fw_start(struct a6xx_gmu *gmu, unsigned int state) |
| 755 | { | 757 | { |
| 756 | static bool rpmh_init; | ||
| 757 | struct a6xx_gpu *a6xx_gpu = container_of(gmu, struct a6xx_gpu, gmu); | 758 | struct a6xx_gpu *a6xx_gpu = container_of(gmu, struct a6xx_gpu, gmu); |
| 758 | struct adreno_gpu *adreno_gpu = &a6xx_gpu->base; | 759 | struct adreno_gpu *adreno_gpu = &a6xx_gpu->base; |
| 759 | int ret; | 760 | int ret; |
| @@ -776,15 +777,9 @@ static int a6xx_gmu_fw_start(struct a6xx_gmu *gmu, unsigned int state) · 16 unmodified lines | |||
| 776 | /* Turn on register retention */ | 777 | /* Turn on register retention */ |
| 777 | gmu_write(gmu, REG_A6XX_GMU_GENERAL_7, 1); | 778 | gmu_write(gmu, REG_A6XX_GMU_GENERAL_7, 1); |
| 778 | 779 | ||
| 779 | /* We only need to load the RPMh microcode once */ | 780 | ret = a6xx_rpmh_start(gmu); |
| 780 | if (!rpmh_init) { | 781 | if (ret) |
| 781 | a6xx_gmu_rpmh_init(gmu); | 782 | return ret; |
| 782 | rpmh_init = true; | ||
| 783 | } else { | ||
| 784 | ret = a6xx_rpmh_start(gmu); | ||
| 785 | if (ret) | ||
| 786 | return ret; | ||
| 787 | } | ||
| 788 | 783 | ||
| 789 | ret = a6xx_gmu_fw_load(gmu); | 784 | ret = a6xx_gmu_fw_load(gmu); |
| 790 | if (ret) | 785 | if (ret) |
| @@ -1670,6 +1665,9 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node) · 879 unmodified lines | |||
| 1670 | /* Set up the HFI queues */ | 1665 | /* Set up the HFI queues */ |
| 1671 | a6xx_hfi_init(gmu); | 1666 | a6xx_hfi_init(gmu); |
| 1672 | 1667 | ||
| 1668 | /* Initialize RPMh */ | ||
| 1669 | a6xx_gmu_rpmh_init(gmu); | ||
| 1670 | |||
| 1673 | gmu->initialized = true; | 1671 | gmu->initialized = true; |
| 1674 | 1672 | ||
| 1675 | return 0; | 1673 | return 0; |