diff options
Diffstat (limited to 'drivers/gpu/drm/msm/msm_gpu.c')
| -rw-r--r-- | drivers/gpu/drm/msm/msm_gpu.c | 68 | 
1 files changed, 35 insertions, 33 deletions
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c index 5bb09838b5ae..b28527a65d09 100644 --- a/drivers/gpu/drm/msm/msm_gpu.c +++ b/drivers/gpu/drm/msm/msm_gpu.c @@ -91,21 +91,20 @@ static int disable_pwrrail(struct msm_gpu *gpu)  static int enable_clk(struct msm_gpu *gpu)  { -	struct clk *rate_clk = NULL;  	int i; -	/* NOTE: kgsl_pwrctrl_clk() ignores grp_clks[0].. */ -	for (i = ARRAY_SIZE(gpu->grp_clks) - 1; i > 0; i--) { -		if (gpu->grp_clks[i]) { -			clk_prepare(gpu->grp_clks[i]); -			rate_clk = gpu->grp_clks[i]; -		} -	} +	if (gpu->grp_clks[0] && gpu->fast_rate) +		clk_set_rate(gpu->grp_clks[0], gpu->fast_rate); -	if (rate_clk && gpu->fast_rate) -		clk_set_rate(rate_clk, gpu->fast_rate); +	/* Set the RBBM timer rate to 19.2Mhz */ +	if (gpu->grp_clks[2]) +		clk_set_rate(gpu->grp_clks[2], 19200000); -	for (i = ARRAY_SIZE(gpu->grp_clks) - 1; i > 0; i--) +	for (i = ARRAY_SIZE(gpu->grp_clks) - 1; i >= 0; i--) +		if (gpu->grp_clks[i]) +			clk_prepare(gpu->grp_clks[i]); + +	for (i = ARRAY_SIZE(gpu->grp_clks) - 1; i >= 0; i--)  		if (gpu->grp_clks[i])  			clk_enable(gpu->grp_clks[i]); @@ -114,24 +113,22 @@ static int enable_clk(struct msm_gpu *gpu)  static int disable_clk(struct msm_gpu *gpu)  { -	struct clk *rate_clk = NULL;  	int i; -	/* NOTE: kgsl_pwrctrl_clk() ignores grp_clks[0].. */ -	for (i = ARRAY_SIZE(gpu->grp_clks) - 1; i > 0; i--) { -		if (gpu->grp_clks[i]) { +	for (i = ARRAY_SIZE(gpu->grp_clks) - 1; i >= 0; i--) +		if (gpu->grp_clks[i])  			clk_disable(gpu->grp_clks[i]); -			rate_clk = gpu->grp_clks[i]; -		} -	} - -	if (rate_clk && gpu->slow_rate) -		clk_set_rate(rate_clk, gpu->slow_rate); -	for (i = ARRAY_SIZE(gpu->grp_clks) - 1; i > 0; i--) +	for (i = ARRAY_SIZE(gpu->grp_clks) - 1; i >= 0; i--)  		if (gpu->grp_clks[i])  			clk_unprepare(gpu->grp_clks[i]); +	if (gpu->grp_clks[0] && gpu->slow_rate) +		clk_set_rate(gpu->grp_clks[0], gpu->slow_rate); + +	if (gpu->grp_clks[2]) +		clk_set_rate(gpu->grp_clks[2], 0); +  	return 0;  } @@ -476,7 +473,7 @@ static void retire_submits(struct msm_gpu *gpu)  		submit = list_first_entry(&gpu->submit_list,  				struct msm_gem_submit, node); -		if (fence_is_signaled(submit->fence)) { +		if (dma_fence_is_signaled(submit->fence)) {  			retire_submit(gpu, submit);  		} else {  			break; @@ -528,7 +525,7 @@ void msm_gpu_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit,  	for (i = 0; i < submit->nr_bos; i++) {  		struct msm_gem_object *msm_obj = submit->bos[i].obj; -		uint32_t iova; +		uint64_t iova;  		/* can't happen yet.. but when we add 2d support we'll have  		 * to deal w/ cross-ring synchronization: @@ -563,8 +560,8 @@ static irqreturn_t irq_handler(int irq, void *data)  }  static const char *clk_names[] = { -		"src_clk", "core_clk", "iface_clk", "mem_clk", "mem_iface_clk", -		"alt_mem_iface_clk", +		"core_clk", "iface_clk", "rbbmtimer_clk", "mem_clk", +		"mem_iface_clk", "alt_mem_iface_clk",  };  int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev, @@ -656,12 +653,17 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev,  	 */  	iommu = iommu_domain_alloc(&platform_bus_type);  	if (iommu) { +		/* TODO 32b vs 64b address space.. */ +		iommu->geometry.aperture_start = SZ_16M; +		iommu->geometry.aperture_end = 0xffffffff; +  		dev_info(drm->dev, "%s: using IOMMU\n", name); -		gpu->mmu = msm_iommu_new(&pdev->dev, iommu); -		if (IS_ERR(gpu->mmu)) { -			ret = PTR_ERR(gpu->mmu); +		gpu->aspace = msm_gem_address_space_create(&pdev->dev, +				iommu, "gpu"); +		if (IS_ERR(gpu->aspace)) { +			ret = PTR_ERR(gpu->aspace);  			dev_err(drm->dev, "failed to init iommu: %d\n", ret); -			gpu->mmu = NULL; +			gpu->aspace = NULL;  			iommu_domain_free(iommu);  			goto fail;  		} @@ -669,7 +671,7 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev,  	} else {  		dev_info(drm->dev, "%s: no IOMMU, fallback to VRAM carveout!\n", name);  	} -	gpu->id = msm_register_mmu(drm, gpu->mmu); +	gpu->id = msm_register_address_space(drm, gpu->aspace);  	/* Create ringbuffer: */ @@ -705,8 +707,8 @@ void msm_gpu_cleanup(struct msm_gpu *gpu)  		msm_ringbuffer_destroy(gpu->rb);  	} -	if (gpu->mmu) -		gpu->mmu->funcs->destroy(gpu->mmu); +	if (gpu->aspace) +		msm_gem_address_space_destroy(gpu->aspace);  	if (gpu->fctx)  		msm_fence_context_free(gpu->fctx);  |