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

Commit c47dcd4f authored by Patrick Daly's avatar Patrick Daly Committed by Gerrit - the friendly Code Review server
Browse files

iommu: arm-smmu: Fixup of_iommu_configure failure



The upstream iommu framework attempts to probe the iommu driver as a
postcore_initcall, and register iommu_ops. Later in arch_initcall_sync,
of_platform_default_populate_init() causes of_iommu_configure to be called
for each device, and call iommu_ops->of_xlate() as appropriate.

However due to resource dependencies on clocks and regulators, the msmskunk
iommu driver cannot be probed until after the clock and regulator drivers
have probed. Therefore the first pass at of_iommu_configure fails since the
iommu_ops are not registered.

Fix this by calling of_iommu_configure() manually at the end of iommu
driver probe.

Change-Id: I95581349a0aa7255633f51f02f51f9b91f17f9ef
Signed-off-by: default avatarPatrick Daly <pdaly@codeaurora.org>
parent 3ae5b10c
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -3599,6 +3599,14 @@ static const struct of_device_id arm_smmu_of_match[] = {
};
MODULE_DEVICE_TABLE(of, arm_smmu_of_match);


static int arm_smmu_of_iommu_configure_fixup(struct device *dev, void *data)
{
	if (!dev->iommu_fwspec)
		of_iommu_configure(dev, dev->of_node);
	return 0;
}

static int qsmmuv500_tbu_register(struct device *dev, void *data);
static int arm_smmu_device_dt_probe(struct platform_device *pdev)
{
@@ -3726,6 +3734,10 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
	arm_smmu_device_reset(smmu);
	arm_smmu_power_off(smmu->pwr);

	/* bus_set_iommu depends on this. */
	bus_for_each_dev(&platform_bus_type, NULL, NULL,
			 arm_smmu_of_iommu_configure_fixup);

	/* Oh, for a proper bus abstraction */
	if (!iommu_present(&platform_bus_type))
		bus_set_iommu(&platform_bus_type, &arm_smmu_ops);