Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b003b955 authored by Rohit Vaswani's avatar Rohit Vaswani
Browse files

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: default avatarRohit Vaswani <rvaswani@codeaurora.org>
parent e7c95927
Loading
Loading
Loading
Loading
+18 −17
Original line number Diff line number Diff line
@@ -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)
{
	if (!smmu->gdsc)
		return 0;

	arm_smmu_unprepare_clocks(smmu);
	arm_smmu_unrequest_bus(smmu);
	if (!smmu->gdsc)
		return 0;
	return regulator_disable(smmu->gdsc);
}

@@ -763,25 +762,27 @@ static int arm_smmu_enable_regulators(struct arm_smmu_device *smmu)
{
	int ret;

	if (!smmu->gdsc)
		return 0;

	if (smmu->gdsc) {
		ret = regulator_enable(smmu->gdsc);
		if (ret)
		return ret;

	ret = arm_smmu_request_bus(smmu);
	if (ret) {
		regulator_disable(smmu->gdsc);
			goto out;
	}

	ret = arm_smmu_request_bus(smmu);
	if (ret)
		goto out_reg;

	ret = arm_smmu_prepare_clocks(smmu);
	if (ret) {
	if (ret)
		goto out_bus;

	return ret;

out_bus:
	arm_smmu_unrequest_bus(smmu);
out_reg:
	if (smmu->gdsc)
		regulator_disable(smmu->gdsc);
	}

out:
	return ret;
}