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

Commit 5fc5eb5f authored by Vamsi Krishna Samavedam's avatar Vamsi Krishna Samavedam
Browse files

usb: dwc3: Disable u1/u2 only for SSP



SNPS STAR: "9001276244: LFPS Handshake Interoperability Issues"
describes two workarounds to avoid interoperability issues with SSP
(Super Speed Plus) USB Hosts. One of the workaround is to disable
U1/U2 completely when operating in SSP Mode.

Change-Id: I64fcd4adc21d985fa68f6cdc42189f75bb1a22d0
Signed-off-by: default avatarVamsi Krishna Samavedam <vskrishn@codeaurora.org>
parent d8442b9b
Loading
Loading
Loading
Loading
+57 −12
Original line number Diff line number Diff line
@@ -419,9 +419,23 @@ static int dwc3_ep0_handle_u1(struct dwc3 *dwc, enum usb_device_state state,
			(dwc->speed != DWC3_DSTS_SUPERSPEED_PLUS))
		return -EINVAL;

	if (dwc->usb3_u1u2_disable && !enable_dwc3_u1u2)
	/* Ignore all other checks if u1/u2 is enabled from user */
	if (enable_dwc3_u1u2)
		goto enable_u1;

	/*
	 * STAR: "9001276244: LFPS Handshake Interoperability Issues"
	 * has two part workaround, first part is to disable u1/u2
	 * in case of SSP to avoid interoperability issues.
	 */
	if (dwc->revision == DWC3_USB31_REVISION_170A &&
		(dwc->speed == DWC3_DSTS_SUPERSPEED_PLUS))
		return -EINVAL;

	if (dwc->usb3_u1u2_disable)
		return -EINVAL;

enable_u1:
	reg = dwc3_readl(dwc->regs, DWC3_DCTL);
	if (set)
		reg |= DWC3_DCTL_INITU1ENA;
@@ -444,9 +458,23 @@ static int dwc3_ep0_handle_u2(struct dwc3 *dwc, enum usb_device_state state,
			(dwc->speed != DWC3_DSTS_SUPERSPEED_PLUS))
		return -EINVAL;

	if (dwc->usb3_u1u2_disable && !enable_dwc3_u1u2)
	/* Ignore all other checks if u1/u2 is enabled from user */
	if (enable_dwc3_u1u2)
		goto enable_u2;

	/*
	 * STAR: "9001276244: LFPS Handshake Interoperability Issues"
	 * has two part workaround, first part is to disable u1/u2
	 * in case of SSP to avoid interoperability issues.
	 */
	if (dwc->revision == DWC3_USB31_REVISION_170A &&
		(dwc->speed == DWC3_DSTS_SUPERSPEED_PLUS))
		return -EINVAL;

	if (dwc->usb3_u1u2_disable)
		return -EINVAL;

enable_u2:
	reg = dwc3_readl(dwc->regs, DWC3_DCTL);
	if (set)
		reg |= DWC3_DCTL_INITU2ENA;
@@ -714,7 +742,25 @@ static int dwc3_ep0_set_config(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)
				usb_gadget_set_state(&dwc->gadget,
						USB_STATE_CONFIGURED);

			if (!dwc->usb3_u1u2_disable || enable_dwc3_u1u2) {
			/*
			 * Ignore all other checks if u1/u2 is enabled
			 * from user
			 */
			if (enable_dwc3_u1u2)
				goto enable_u1u2;
			/*
			 * STAR:"9001276244: LFPS Handshake Interoperability
			 * Issues" has two part workaround, first part is to
			 * disable u1/u2 in case of SSP to avoid
			 * interoperability issues.
			 */
			if (dwc->revision == DWC3_USB31_REVISION_170A &&
				(dwc->speed == DWC3_DSTS_SUPERSPEED_PLUS))
				break;

			if (dwc->usb3_u1u2_disable)
				break;
enable_u1u2:
			/*
			 * Enable transition to U1/U2 state when
			 * nothing is pending from application.
@@ -724,7 +770,6 @@ static int dwc3_ep0_set_config(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)
						DWC3_DCTL_ACCEPTU2ENA);
			dwc3_writel(dwc->regs, DWC3_DCTL, reg);
		}
		}
		break;

	case USB_STATE_CONFIGURED: