Commit c3595df7 authored by Artur Petrosyan's avatar Artur Petrosyan Committed by Greg Kroah-Hartman
Browse files

usb: dwc2: Allow exit hibernation in urb enqueue



When core is in hibernation state and an external
hub is connected, upper layer sends URB enqueue request,
which results in port reset issue.

- Added exit from hibernation state to avoid port
reset issue and process upper layer request properly.

Acked-by: default avatarMinas Harutyunyan <Minas.Harutyunyan@synopsys.com>
Signed-off-by: default avatarArtur Petrosyan <Arthur.Petrosyan@synopsys.com>
Link: https://lore.kernel.org/r/20210416124803.D1C1FA005F@mailhost.synopsys.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e358c215
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -4631,12 +4631,26 @@ static int _dwc2_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
	struct dwc2_qh *qh;
	bool qh_allocated = false;
	struct dwc2_qtd *qtd;
	struct dwc2_gregs_backup *gr;

	gr = &hsotg->gr_backup;

	if (dbg_urb(urb)) {
		dev_vdbg(hsotg->dev, "DWC OTG HCD URB Enqueue\n");
		dwc2_dump_urb_info(hcd, urb, "urb_enqueue");
	}

	if (hsotg->hibernated) {
		if (gr->gotgctl & GOTGCTL_CURMODE_HOST)
			retval = dwc2_exit_hibernation(hsotg, 0, 0, 1);
		else
			retval = dwc2_exit_hibernation(hsotg, 0, 0, 0);

		if (retval)
			dev_err(hsotg->dev,
				"exit hibernation failed.\n");
	}

	if (hsotg->in_ppd) {
		retval = dwc2_exit_partial_power_down(hsotg, 0, true);
		if (retval)