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

Commit 1168ddee authored by Lokesh Batra's avatar Lokesh Batra
Browse files

msm: kgsl: Add support for gtcu-ahb-clk



For graphics self-programming in MSM8916, the KGSL driver needs to
enable the gtcu-ahb-clk. Need to turn on this clock only when GPU
programs ARM SMMU. CPU takes a different route to program the same
SMMU. Hence when using global page tables, this clock need not be
enabled.

Change-Id: Ibc774abe8b89986eae89c435032656c7ce65e769
Signed-off-by: default avatarLokesh Batra <lbatra@codeaurora.org>
parent af289785
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -477,6 +477,8 @@ static void kgsl_iommu_disable_clk(struct kgsl_mmu *mmu, int ctx_id)
			 */
			iommu_drvdata = dev_get_drvdata(
					iommu_unit->dev[j].dev->parent);
			if (iommu->gtcu_iface_clk)
				clk_disable_unprepare(iommu->gtcu_iface_clk);
			if (iommu_drvdata->aclk)
				clk_disable_unprepare(iommu_drvdata->aclk);
			if (iommu_drvdata->clk)
@@ -595,6 +597,11 @@ static int kgsl_iommu_enable_clk(struct kgsl_mmu *mmu,
					goto done;
				}
			}
			if (iommu->gtcu_iface_clk) {
				ret = clk_prepare_enable(iommu->gtcu_iface_clk);
				if (ret)
					goto done;
			}
			atomic_inc(&iommu_unit->dev[j].clk_enable_count);
		}
	}
@@ -1355,6 +1362,8 @@ static int kgsl_iommu_init(struct kgsl_mmu *mmu)
	 */
	int status = 0;
	struct kgsl_iommu *iommu;
	struct platform_device *pdev = container_of(mmu->device->parentdev,
						struct platform_device, dev);

	atomic_set(&mmu->fault, 0);
	iommu = kzalloc(sizeof(struct kgsl_iommu), GFP_KERNEL);
@@ -1378,6 +1387,11 @@ static int kgsl_iommu_init(struct kgsl_mmu *mmu)
				(msm_soc_version_supports_iommu_v0() ||
				 iommu->iommu_units[0].iommu_halt_enable);

	if (mmu->pt_per_process &&
		of_property_match_string(pdev->dev.of_node, "clock-names",
						"gtcu_iface_clk") >= 0)
		iommu->gtcu_iface_clk = clk_get(&pdev->dev, "gtcu_iface_clk");

	/*
	 * For IOMMU per-process pagetables, the allocatable range
	 * and the kernel global range must both be outside
+2 −0
Original line number Diff line number Diff line
@@ -215,6 +215,7 @@ struct kgsl_iommu_unit {
 * @sync_lock_offset - The page offset within a page at which the sync
 * variables are located
 * @sync_lock_initialized: True if the sync_lock feature is enabled
 * @gtcu_iface_clk: The gTCU AHB Clock connected to SMMU
 */
struct kgsl_iommu {
	struct kgsl_iommu_unit iommu_units[KGSL_IOMMU_MAX_UNITS];
@@ -227,6 +228,7 @@ struct kgsl_iommu {
	struct kgsl_memdesc sync_lock_desc;
	unsigned int sync_lock_offset;
	bool sync_lock_initialized;
	struct clk *gtcu_iface_clk;
};

/*