From: ljf Date: Thu, 7 Aug 2014 08:35:40 +0000 (+0800) Subject: add iommu switch in dts for vcodec driver. disable iommu_unmap. X-Git-Tag: firefly_0821_release~4934 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=71f451f7962261d396b3d900b50c5a76a65eae26;p=firefly-linux-kernel-4.4.55.git add iommu switch in dts for vcodec driver. disable iommu_unmap. --- diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi index 9785eb6cb6d1..6353a8babb72 100755 --- a/arch/arm/boot/dts/rk3288.dtsi +++ b/arch/arm/boot/dts/rk3288.dtsi @@ -1003,6 +1003,7 @@ vpu: vpu_service@ff9a0000 { compatible = "vpu_service"; + iommu_enabled = <1>; reg = <0xff9a0000 0x800>; interrupts = , ; interrupt-names = "irq_enc", "irq_dec"; @@ -1014,6 +1015,7 @@ hevc: hevc_service@ff9c0000 { compatible = "rockchip,hevc_service"; + iommu_enabled = <1>; reg = <0xff9c0000 0x800>; interrupts = ; interrupt-names = "irq_dec"; @@ -1025,6 +1027,7 @@ iep: iep@ff900000 { compatible = "rockchip,iep"; + iommu_enabled = <1>; reg = <0xff900000 0x800>; interrupts = ; clocks = <&clk_gates15 2>, <&clk_gates15 3>; diff --git a/arch/arm/mach-rockchip/vcodec_service.c b/arch/arm/mach-rockchip/vcodec_service.c index 1d410e28d9ab..5b4bd9dcb295 100755 --- a/arch/arm/mach-rockchip/vcodec_service.c +++ b/arch/arm/mach-rockchip/vcodec_service.c @@ -873,7 +873,12 @@ static void reg_deinit(struct vpu_service_info *pservice, vpu_reg *reg) // release memory region attach to this registers table. if (pservice->mmu_dev) { list_for_each_entry_safe(mem_region, n, ®->mem_region_list, reg_lnk) { - ion_unmap_iommu(pservice->dev, pservice->ion_client, mem_region->hdl); + /* do not unmap iommu manually, + unmap will proccess when memory release */ + /*ion_unmap_iommu(pservice->dev, + pservice->ion_client, + mem_region->hdl); + vcodec_exit_mode();*/ ion_free(pservice->ion_client, mem_region->hdl); list_del_init(&mem_region->reg_lnk); kfree(mem_region); @@ -1453,7 +1458,9 @@ static int vcodec_probe(struct platform_device *pdev) struct vpu_service_info *pservice = devm_kzalloc(dev, sizeof(struct vpu_service_info), GFP_KERNEL); char *prop = (char*)dev_name(dev); #if defined(CONFIG_VCODEC_MMU) - char mmu_dev_dts_name[40]; + u32 iommu_en = 0; + char mmu_dev_dts_name[40]; + of_property_read_u32(np, "iommu_enabled", &iommu_en); #endif pr_info("probe device %s\n", dev_name(dev)); @@ -1605,26 +1612,27 @@ static int vcodec_probe(struct platform_device *pdev) #endif #if defined(CONFIG_VCODEC_MMU) - pservice->ion_client = rockchip_ion_client_create("vpu"); - if (IS_ERR(pservice->ion_client)) { - dev_err(&pdev->dev, "failed to create ion client for vcodec"); - return PTR_ERR(pservice->ion_client); - } else { - dev_info(&pdev->dev, "vcodec ion client create success!\n"); - } - - if (pservice->hw_info->hw_id == HEVC_ID) { - sprintf(mmu_dev_dts_name, "iommu,hevc_mmu"); - } else { - sprintf(mmu_dev_dts_name, "iommu,vpu_mmu"); - } - - pservice->mmu_dev = rockchip_get_sysmmu_device_by_compatible(mmu_dev_dts_name); - - if (pservice->mmu_dev) { - platform_set_sysmmu(pservice->mmu_dev, pservice->dev); - iovmm_activate(pservice->dev); - } + if (iommu_en) { + pservice->ion_client = rockchip_ion_client_create("vpu"); + if (IS_ERR(pservice->ion_client)) { + dev_err(&pdev->dev, "failed to create ion client for vcodec"); + return PTR_ERR(pservice->ion_client); + } else { + dev_info(&pdev->dev, "vcodec ion client create success!\n"); + } + + if (pservice->hw_info->hw_id == HEVC_ID) + sprintf(mmu_dev_dts_name, "iommu,hevc_mmu"); + else + sprintf(mmu_dev_dts_name, "iommu,vpu_mmu"); + + pservice->mmu_dev = rockchip_get_sysmmu_device_by_compatible(mmu_dev_dts_name); + + if (pservice->mmu_dev) { + platform_set_sysmmu(pservice->mmu_dev, pservice->dev); + iovmm_activate(pservice->dev); + } + } #endif vpu_service_power_off(pservice);