iommu: msm: Make regulators optional
Do not error out if regulators aren't specified in the device tree
node for an IOMMU. This allows IOMMU drivers to be used in simulation
environment and for early bringup of hardware.
Change-Id: I9bb6c3faa7ba5aed482bdad6612197497f7a849d
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
diff --git a/drivers/iommu/msm_iommu_dev-v1.c b/drivers/iommu/msm_iommu_dev-v1.c
index 958b7b1..11f43ae 100644
--- a/drivers/iommu/msm_iommu_dev-v1.c
+++ b/drivers/iommu/msm_iommu_dev-v1.c
@@ -263,13 +263,19 @@
drvdata->glb_base = drvdata->base;
- drvdata->gdsc = devm_regulator_get(&pdev->dev, "vdd");
- if (IS_ERR(drvdata->gdsc))
- return PTR_ERR(drvdata->gdsc);
+ if (of_get_property(pdev->dev.of_node, "vdd-supply", NULL)) {
- drvdata->alt_gdsc = devm_regulator_get(&pdev->dev, "qcom,alt-vdd");
- if (IS_ERR(drvdata->alt_gdsc))
- drvdata->alt_gdsc = NULL;
+ drvdata->gdsc = devm_regulator_get(&pdev->dev, "vdd");
+ if (IS_ERR(drvdata->gdsc))
+ return PTR_ERR(drvdata->gdsc);
+
+ drvdata->alt_gdsc = devm_regulator_get(&pdev->dev,
+ "qcom,alt-vdd");
+ if (IS_ERR(drvdata->alt_gdsc))
+ drvdata->alt_gdsc = NULL;
+ } else {
+ pr_debug("Warning: No regulator specified for IOMMU\n");
+ }
drvdata->pclk = devm_clk_get(&pdev->dev, "iface_clk");
if (IS_ERR(drvdata->pclk))