Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2ba0b21f authored by Akhil P Oommen's avatar Akhil P Oommen
Browse files

msm: kgsl: Keep vote on clocks while programing SMMU



SMMU clocks should be enabled when accessing smmu registers. So keep a
vote on smmu clocks while programing QSMMU workaround. Also, keep smmu
clocks enabled through out kgsl_iommu_start() to avoid unnecessary
latencies due to multiple toggling of these clocks.

Change-Id: I2d0a4590d5969db8fe8ef063c841b7457268c999
Signed-off-by: default avatarAkhil P Oommen <akhilpo@codeaurora.org>
parent 955a96f0
Loading
Loading
Loading
Loading
+16 −13
Original line number Diff line number Diff line
@@ -1581,8 +1581,6 @@ static int _setup_user_context(struct kgsl_mmu *mmu)

	ctx->default_pt = mmu->defaultpagetable;

	kgsl_iommu_enable_clk(mmu);

	sctlr_val = KGSL_IOMMU_GET_CTX_REG(ctx, SCTLR);

	/*
@@ -1605,7 +1603,6 @@ static int _setup_user_context(struct kgsl_mmu *mmu)
		sctlr_val |= (0x1 << KGSL_IOMMU_SCTLR_HUPCF_SHIFT);
	}
	KGSL_IOMMU_SET_CTX_REG(ctx, SCTLR, sctlr_val);
	kgsl_iommu_disable_clk(mmu);

	return 0;
}
@@ -1654,6 +1651,21 @@ static int kgsl_iommu_start(struct kgsl_mmu *mmu)
	int status;
	struct kgsl_iommu *iommu = _IOMMU_PRIV(mmu);

	kgsl_iommu_enable_clk(mmu);

	status = _setup_user_context(mmu);
	if (status) {
		kgsl_iommu_disable_clk(mmu);
		return status;
	}

	status = _setup_secure_context(mmu);
	if (status) {
		_detach_context(&iommu->ctx[KGSL_IOMMU_CONTEXT_USER]);
		kgsl_iommu_disable_clk(mmu);
		return status;
	}

	/* Set the following registers only when the MMU type is QSMMU */
	if (mmu->subtype != KGSL_IOMMU_SMMU_V500) {
		/* Enable hazard check from GPU_SMMU_HUM_CFG */
@@ -1666,18 +1678,9 @@ static int kgsl_iommu_start(struct kgsl_mmu *mmu)
		wmb();
	}

	status = _setup_user_context(mmu);
	if (status)
		return status;

	status = _setup_secure_context(mmu);
	if (status) {
		_detach_context(&iommu->ctx[KGSL_IOMMU_CONTEXT_USER]);
		return status;
	}

	/* Make sure the hardware is programmed to the default pagetable */
	kgsl_iommu_set_pt(mmu, mmu->defaultpagetable);
	kgsl_iommu_disable_clk(mmu);
	set_bit(KGSL_MMU_STARTED, &mmu->flags);
	return 0;
}