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

Commit 42dfac44 authored by Mayank Rana's avatar Mayank Rana
Browse files

dwc3-msm: Use dma mask related APIs after attaching IOMMU



When dwc3-msm driver's probe encounters -EPROBE_DEFER condition
(e.g. extcon phandle access failure case), it detaches IOMMU using
arm_iommu_detach_device() API. This detach API clears device's
dma_ops() when DOMAIN_ATTR_S1_BYPASS is not set. Hence next time
driver's probe is failing as dma_set_mask() API returns -EIO. Fix
this issue by using dma mask related APIs after attaching IOMMU
with USB device.

Change-Id: I7f9e13ed950bcbad27a27bc5ed8ccaa664ca19d7
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent 54d765eb
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -3131,14 +3131,6 @@ static int dwc3_msm_probe(struct platform_device *pdev)
	if (!mdwc)
		return -ENOMEM;

	if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64))) {
		dev_err(&pdev->dev, "setting DMA mask to 64 failed.\n");
		if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32))) {
			dev_err(&pdev->dev, "setting DMA mask to 32 failed.\n");
			return -EOPNOTSUPP;
		}
	}

	platform_set_drvdata(pdev, mdwc);
	mdwc->dev = &pdev->dev;

@@ -3331,6 +3323,15 @@ static int dwc3_msm_probe(struct platform_device *pdev)
	if (ret)
		goto err;

	if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64))) {
		dev_err(&pdev->dev, "setting DMA mask to 64 failed.\n");
		if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32))) {
			dev_err(&pdev->dev, "setting DMA mask to 32 failed.\n");
			ret = -EOPNOTSUPP;
			goto uninit_iommu;
		}
	}

	/* Assumes dwc3 is the first DT child of dwc3-msm */
	dwc3_node = of_get_next_available_child(node, NULL);
	if (!dwc3_node) {