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

Commit 283cece2 authored by Jack Pham's avatar Jack Pham
Browse files

usb: dwc3: msm: Add option to bypass SMMU stage 1



In some cases USB may need to configure SMMU to bypass stage 1
translations. This is done by setting the DOMAIN_ATTR_S1_BYPASS
attribute prior to attaching to IOMMU. Add a devicetree binding
to configure this.

Change-Id: Iea5c3e741de4bda73dc0c74c3016f0158136d64b
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent 4da25c7f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ Optional properties :
  event buffers. 1 event buffer is needed per h/w accelerated endpoint.
- qcom,pm-qos-latency: This represents max tolerable CPU latency in microsecs,
	which is used as a vote by driver to get max performance in perf mode.
- qcom,smmu-s1-bypass: If present, configure SMMU to bypass stage 1 translation.

Sub nodes:
- Sub node for "DWC3- USB3 controller".
+10 −1
Original line number Diff line number Diff line
@@ -2790,7 +2790,7 @@ static int dwc3_msm_extcon_register(struct dwc3_msm *mdwc)
static int dwc3_msm_init_iommu(struct dwc3_msm *mdwc)
{
	struct device_node *node = mdwc->dev->of_node;
	int atomic_ctx = 1;
	int atomic_ctx = 1, s1_bypass;
	int ret;

	if (!of_property_read_bool(node, "iommus"))
@@ -2814,6 +2814,15 @@ static int dwc3_msm_init_iommu(struct dwc3_msm *mdwc)
		goto release_mapping;
	}

	s1_bypass = of_property_read_bool(node, "qcom,smmu-s1-bypass");
	ret = iommu_domain_set_attr(mdwc->iommu_map->domain,
			DOMAIN_ATTR_S1_BYPASS, &s1_bypass);
	if (ret) {
		dev_err(mdwc->dev, "IOMMU set s1 bypass (%d) failed (%d)\n",
			s1_bypass, ret);
		goto release_mapping;
	}

	ret = arm_iommu_attach_device(mdwc->dev, mdwc->iommu_map);
	if (ret) {
		dev_err(mdwc->dev, "IOMMU attach failed (%d)\n", ret);