From 97b53cbfafd7f499f54f90c18093383f91a0664d Mon Sep 17 00:00:00 2001
From: Heiko Stuebner <heiko@sntech.de>
Date: Mon, 9 Apr 2018 23:01:35 +0200
Subject: [PATCH 2/2] iommu/rockchip: make clock handling optional

iommu clocks are optional, so the driver should not fail if they are not
present. Instead just set the number of clocks to 0, which the clk-blk APIs
can handle just fine.

Fixes: f2e3a5f557ad ("iommu/rockchip: Control clocks needed to access the IOMMU")
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 drivers/iommu/rockchip-iommu.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
index 5fc8656c60f9..7215c683cb8f 100644
--- a/drivers/iommu/rockchip-iommu.c
+++ b/drivers/iommu/rockchip-iommu.c
@@ -1176,8 +1176,12 @@ static int rk_iommu_probe(struct platform_device *pdev)
 		iommu->clocks[i].id = rk_iommu_clocks[i];
 
 	err = devm_clk_bulk_get(iommu->dev, iommu->num_clocks, iommu->clocks);
-	if (err)
-		return err;
+	if (err) {
+		if (err == -ENOENT)
+			iommu->num_clocks = 0;
+		else
+			return err;
+	}
 
 	err = clk_bulk_prepare(iommu->num_clocks, iommu->clocks);
 	if (err)
-- 
2.16.2

