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

Commit 4b899684 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ARM: dts: msm: Enable USB3 LPM with both USB controller on SDM845"

parents ac1983e7 7d7fd713
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@
			snps,disable-clk-gating;
			snps,has-lpm-erratum;
			snps,hird-threshold = /bits/ 8 <0x10>;
			snps,usb3_lpm_capable;
			usb-core-id = <0>;
		};

@@ -387,6 +388,7 @@
			snps,disable-clk-gating;
			snps,has-lpm-erratum;
			snps,hird-threshold = /bits/ 8 <0x10>;
			snps,usb3_lpm_capable;
			usb-core-id = <1>;
		};
	};
+4 −43
Original line number Diff line number Diff line
@@ -977,41 +977,14 @@ static int dwc3_core_init_mode(struct dwc3 *dwc)
	struct device *dev = dwc->dev;
	int ret;

	switch (dwc->dr_mode) {
	case USB_DR_MODE_PERIPHERAL:
		ret = dwc3_gadget_init(dwc);
		if (ret) {
			if (ret != -EPROBE_DEFER)
				dev_err(dev, "failed to initialize gadget\n");
			return ret;
		}
		break;
	case USB_DR_MODE_HOST:
		ret = dwc3_host_init(dwc);
		if (ret) {
			if (ret != -EPROBE_DEFER)
				dev_err(dev, "failed to initialize host\n");
			return ret;
		}
		break;
	case USB_DR_MODE_OTG:
		ret = dwc3_host_init(dwc);
		if (ret) {
			if (ret != -EPROBE_DEFER)
				dev_err(dev, "failed to initialize host\n");
			return ret;
		}

	if (dwc->dr_mode == USB_DR_MODE_OTG ||
			dwc->dr_mode == USB_DR_MODE_PERIPHERAL) {
		ret = dwc3_gadget_init(dwc);
		if (ret) {
			if (ret != -EPROBE_DEFER)
				dev_err(dev, "failed to initialize gadget\n");
			return ret;
		}
		break;
	default:
		dev_err(dev, "Unsupported mode of operation %d\n", dwc->dr_mode);
		return -EINVAL;
	}

	return 0;
@@ -1019,21 +992,9 @@ static int dwc3_core_init_mode(struct dwc3 *dwc)

static void dwc3_core_exit_mode(struct dwc3 *dwc)
{
	switch (dwc->dr_mode) {
	case USB_DR_MODE_PERIPHERAL:
		dwc3_gadget_exit(dwc);
		break;
	case USB_DR_MODE_HOST:
		dwc3_host_exit(dwc);
		break;
	case USB_DR_MODE_OTG:
		dwc3_host_exit(dwc);
	if (dwc->dr_mode == USB_DR_MODE_PERIPHERAL ||
			dwc->dr_mode == USB_DR_MODE_OTG)
		dwc3_gadget_exit(dwc);
		break;
	default:
		/* do nothing */
		break;
	}
}

/* XHCI reset, resets other CORE registers as well, re-init those */
+2 −13
Original line number Diff line number Diff line
@@ -3667,9 +3667,6 @@ static int dwc3_otg_start_host(struct dwc3_msm *mdwc, int on)
	struct dwc3 *dwc = platform_get_drvdata(mdwc->dwc3);
	int ret = 0;

	if (!dwc->xhci)
		return -EINVAL;

	/*
	 * The vbus_reg pointer could have multiple values
	 * NULL: regulator_get() hasn't been called, or was previously deferred
@@ -3720,15 +3717,7 @@ static int dwc3_otg_start_host(struct dwc3_msm *mdwc, int on)

		mdwc->usbdev_nb.notifier_call = msm_dwc3_usbdev_notify;
		usb_register_atomic_notify(&mdwc->usbdev_nb);
		/*
		 * FIXME If micro A cable is disconnected during system suspend,
		 * xhci platform device will be removed before runtime pm is
		 * enabled for xhci device. Due to this, disable_depth becomes
		 * greater than one and runtimepm is not enabled for next microA
		 * connect. Fix this by calling pm_runtime_init for xhci device.
		 */
		pm_runtime_init(&dwc->xhci->dev);
		ret = platform_device_add(dwc->xhci);
		ret = dwc3_host_init(dwc);
		if (ret) {
			dev_err(mdwc->dev,
				"%s: failed to add XHCI pdev ret=%d\n",
@@ -3796,7 +3785,7 @@ static int dwc3_otg_start_host(struct dwc3_msm *mdwc, int on)
		}

		mdwc->hs_phy->flags &= ~PHY_HOST_MODE;
		platform_device_del(dwc->xhci);
		dwc3_host_exit(dwc);
		usb_unregister_notify(&mdwc->host_nb);

		dwc3_usb3_phy_suspend(dwc, false);
+6 −3
Original line number Diff line number Diff line
@@ -126,7 +126,11 @@ int dwc3_host_init(struct dwc3 *dwc)
	phy_create_lookup(dwc->usb3_generic_phy, "usb3-phy",
			  dev_name(dwc->dev));

	/* Platform device gets added as part of state machine */
	ret = platform_device_add(xhci);
	if (ret) {
		dev_err(dwc->dev, "failed to register xHCI device\n");
		goto err1;
	}

	return 0;
err1:
@@ -140,6 +144,5 @@ void dwc3_host_exit(struct dwc3 *dwc)
			  dev_name(dwc->dev));
	phy_remove_lookup(dwc->usb3_generic_phy, "usb3-phy",
			  dev_name(dwc->dev));
	if (!dwc->is_drd)
	platform_device_unregister(dwc->xhci);
}