iommu/rockchip: make compatible to extra sclk

Change-Id: Ia9821eb74effd0b61a42c5cb19ca12f9cf036b78
Signed-off-by: Simon Xue <xxm@rock-chips.com>
This commit is contained in:
Simon Xue
2019-08-23 12:12:32 +08:00
committed by Tao Huang
parent 51556b4a24
commit e3fb92c722

View File

@@ -1217,21 +1217,32 @@ static int rk_iommu_probe(struct platform_device *pdev)
"rockchip,skip-mmu-read");
iommu->num_clocks = ARRAY_SIZE(rk_iommu_clocks);
/* RK1808 isp iommu has an extra sclk */
err = of_property_match_string(dev->of_node, "clock-names", "sclk");
if (err >= 0)
iommu->num_clocks++;
iommu->clocks = devm_kcalloc(iommu->dev, iommu->num_clocks,
sizeof(*iommu->clocks), GFP_KERNEL);
if (!iommu->clocks)
return -ENOMEM;
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");
}
if (i == 2) {
iommu->clocks[i].id = "sclk";
} else {
iommu->clocks[i].id = rk_iommu_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];
}
}
}
/*