iommu/arm-smmu: Reorganize code to allow no gdsc
Some SMMUs may not have a dedicated gdsc for it. Allow for the enable code to prepare clocks and vote for bus requests even if there is no gdsc provided. Change-Id: Iaedfb73d8ae7f12895472893468e5c32d2bf2462 Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
This commit is contained in:
parent
6408533e2a
commit
25e3f17849
1 changed files with 18 additions and 17 deletions
|
@ -751,11 +751,10 @@ static int arm_smmu_unrequest_bus(struct arm_smmu_device *smmu)
|
||||||
|
|
||||||
static int arm_smmu_disable_regulators(struct arm_smmu_device *smmu)
|
static int arm_smmu_disable_regulators(struct arm_smmu_device *smmu)
|
||||||
{
|
{
|
||||||
if (!smmu->gdsc)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
arm_smmu_unprepare_clocks(smmu);
|
arm_smmu_unprepare_clocks(smmu);
|
||||||
arm_smmu_unrequest_bus(smmu);
|
arm_smmu_unrequest_bus(smmu);
|
||||||
|
if (!smmu->gdsc)
|
||||||
|
return 0;
|
||||||
return regulator_disable(smmu->gdsc);
|
return regulator_disable(smmu->gdsc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -763,25 +762,27 @@ static int arm_smmu_enable_regulators(struct arm_smmu_device *smmu)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!smmu->gdsc)
|
if (smmu->gdsc) {
|
||||||
return 0;
|
ret = regulator_enable(smmu->gdsc);
|
||||||
|
if (ret)
|
||||||
ret = regulator_enable(smmu->gdsc);
|
goto out;
|
||||||
if (ret)
|
}
|
||||||
return ret;
|
|
||||||
|
|
||||||
ret = arm_smmu_request_bus(smmu);
|
ret = arm_smmu_request_bus(smmu);
|
||||||
if (ret) {
|
if (ret)
|
||||||
regulator_disable(smmu->gdsc);
|
goto out_reg;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = arm_smmu_prepare_clocks(smmu);
|
ret = arm_smmu_prepare_clocks(smmu);
|
||||||
if (ret) {
|
if (ret)
|
||||||
arm_smmu_unrequest_bus(smmu);
|
goto out_bus;
|
||||||
regulator_disable(smmu->gdsc);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
out_bus:
|
||||||
|
arm_smmu_unrequest_bus(smmu);
|
||||||
|
out_reg:
|
||||||
|
if (smmu->gdsc)
|
||||||
|
regulator_disable(smmu->gdsc);
|
||||||
out:
|
out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue