Commit 188db3d7fe66 ("drm/msm/a6xx: Rebase GMU register offsets") maps
the rscc, gmu_pdc and gmu_pdc_seq regions with
devm_platform_ioremap_resource_byname() on the GMU device. That device
has no driver, so its devres are never released and the regions cannot
be requested again on the next bind:
3d6a000.gmu: error -EBUSY: can't request region for resource
[mem 0x03d50000-0x03d5ffff]
msm_dpu ae01000.display-controller: failed to bind 3d00000.gpu (...): -19
For gmu_pdc the failure is silent and the RSC/PDC setup is skipped.
Keep the managed mappings, but attach them to the GPU device. They are
created from the GPU component bind, so component_unbind(), or a failed
bind, releases them through the devres group opened by
component_bind().
Fixes: 188db3d7fe66 ("drm/msm/a6xx: Rebase GMU register offsets")
Cc: [email protected]
Signed-off-by: Yuanjie Yang <[email protected]>
---
drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index a1561ca41a5b..e1178053953a 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -684,11 +684,20 @@ static inline void pdc_write(void __iomem *ptr, u32
offset, u32 value)
writel(value, ptr + (offset << 2));
}
+static void __iomem *a6xx_gmu_ioremap_byname(struct a6xx_gmu *gmu,
+ const char *name)
+{
+ struct a6xx_gpu *a6xx_gpu = container_of(gmu, struct a6xx_gpu, gmu);
+ struct platform_device *pdev = to_platform_device(gmu->dev);
+
+ return devm_ioremap_resource(&a6xx_gpu->base.base.pdev->dev,
+ platform_get_resource_byname(pdev, IORESOURCE_MEM, name));
+}
+
static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)
{
struct a6xx_gpu *a6xx_gpu = container_of(gmu, struct a6xx_gpu, gmu);
struct adreno_gpu *adreno_gpu = &a6xx_gpu->base;
- struct platform_device *pdev = to_platform_device(gmu->dev);
u32 seqmem0_drv0_reg = REG_A6XX_RSCC_SEQ_MEM_0_DRV0;
void __iomem *seqptr = NULL;
uint32_t pdc_address_offset;
@@ -699,7 +708,7 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)
if (adreno_is_a8xx(adreno_gpu))
return;
- pdcptr = devm_platform_ioremap_resource_byname(pdev, "gmu_pdc");
+ pdcptr = a6xx_gmu_ioremap_byname(gmu, "gmu_pdc");
if (IS_ERR(pdcptr))
return;
@@ -714,7 +723,7 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)
pdc_address_offset = 0x30080;
if (!pdc_in_aop) {
- seqptr = devm_platform_ioremap_resource_byname(pdev,
"gmu_pdc_seq");
+ seqptr = a6xx_gmu_ioremap_byname(gmu, "gmu_pdc_seq");
if (IS_ERR(seqptr))
return;
}
@@ -2464,7 +2473,7 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct
device_node *node)
if (adreno_is_a650_family(adreno_gpu) ||
adreno_is_a7xx(adreno_gpu)) {
- gmu->rscc = devm_platform_ioremap_resource_byname(pdev, "rscc");
+ gmu->rscc = a6xx_gmu_ioremap_byname(gmu, "rscc");
if (IS_ERR(gmu->rscc)) {
ret = -ENODEV;
goto err_mmio;
--
2.43.0