From c285cc3dd7f99c01f84bbd681e1a156c75e16933 Mon Sep 17 00:00:00 2001 From: Simon Xue Date: Thu, 21 Mar 2024 10:53:57 +0800 Subject: [PATCH] iommu/rockchip: add rockchip,disable-first-mmu-reset for vop_mmu Don't force reset iommu when enable vop iommu firstly on RK3576 platform Change-Id: I4cc27d051fec1d3f6a26f0a2fc9913bb9760c892 Signed-off-by: Simon Xue --- drivers/iommu/rockchip-iommu.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c index b28a3f7cb7d2..c48af6b2d865 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c @@ -117,6 +117,7 @@ struct rk_iommu { bool dlr_disable; /* avoid access iommu when runtime ops called */ bool cmd_retry; bool master_handle_irq; + bool first_reset_disabled; struct iommu_device iommu; struct list_head node; /* entry in rk_iommu_domain.iommus */ struct iommu_domain *domain; /* domain to which iommu is attached */ @@ -577,7 +578,7 @@ static int rk_iommu_force_reset(struct rk_iommu *iommu) bool val; u32 dte_address_mask; - if (iommu->reset_disabled) + if (iommu->reset_disabled || iommu->first_reset_disabled) return 0; if (iommu->skip_read) @@ -1189,8 +1190,10 @@ out_disable_stall: out_disable_clocks: clk_bulk_disable(iommu->num_clocks, iommu->clocks); - if (!ret) + if (!ret) { iommu->iommu_enabled = true; + iommu->first_reset_disabled = false; + } return ret; } @@ -1622,7 +1625,8 @@ static int rk_iommu_probe(struct platform_device *pdev) iommu->need_res_map = device_property_read_bool(dev, "rockchip,reserve-map"); - + iommu->first_reset_disabled = device_property_read_bool(dev, + "rockchip,disable-first-mmu-reset"); /* * iommu clocks should be present for all new devices and devicetrees * but there are older devicetrees without clocks out in the wild.