From 53af1d4ee1f7652018a05f5126d7bcdb9f136178 Mon Sep 17 00:00:00 2001 From: Simon Xue Date: Tue, 20 Aug 2019 14:23:34 +0800 Subject: [PATCH] iommu/rockchip: make compatible to iommu who use "hclk" in dts Change-Id: If7c5c48e78cdbf189dd445980a61f4ffeb7082ce Signed-off-by: Simon Xue --- drivers/iommu/rockchip-iommu.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c index 854ed28839c1..ff3b441d8605 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c @@ -1222,9 +1222,18 @@ static int rk_iommu_probe(struct platform_device *pdev) if (!iommu->clocks) return -ENOMEM; - for (i = 0; i < iommu->num_clocks; ++i) - iommu->clocks[i].id = rk_iommu_clocks[i]; - + for (i = 0; i < iommu->num_clocks; ++i) { + err = of_property_match_string(dev->of_node, "clock-names", + rk_iommu_clocks[i]); + if (err < 0) { + if (!strcmp(rk_iommu_clocks[i], "iface")) { + iommu->clocks[i].id = "hclk"; + dev_warn(dev, "iommu hclk need to update to iface\n"); + } + } else { + iommu->clocks[i].id = rk_iommu_clocks[i]; + } + } /* * iommu clocks should be present for all new devices and devicetrees * but there are older devicetrees without clocks out in the wild.