diff mbox series

[v2,10/15] usb: dwc2: Allow exit hibernation in urb enqueue

Message ID 20210416124803.D1C1FA005F@mailhost.synopsys.com
State New
Headers show
Series [01/15] usb: dwc2: Update exit hibernation when port reset is asserted | expand

Commit Message

Artur Petrosyan April 16, 2021, 12:48 p.m. UTC
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.

Signed-off-by: Artur Petrosyan <Arthur.Petrosyan@synopsys.com>
---
 Changes in v2:
 - Moved duplicated error checking *if* conditions from innermost to outside if.

 drivers/usb/dwc2/hcd.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Minas Harutyunyan April 19, 2021, 7:31 a.m. UTC | #1
On 4/16/2021 4:48 PM, Artur Petrosyan wrote:
> 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.

> 

> Signed-off-by: Artur Petrosyan <Arthur.Petrosyan@synopsys.com>


Acked-by: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>


> ---

>   Changes in v2:

>   - Moved duplicated error checking *if* conditions from innermost to outside if.

> 

>   drivers/usb/dwc2/hcd.c | 14 ++++++++++++++

>   1 file changed, 14 insertions(+)

> 

> diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c

> index cc9ad6cf02d9..093b1717df01 100644

> --- a/drivers/usb/dwc2/hcd.c

> +++ b/drivers/usb/dwc2/hcd.c

> @@ -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)

>
diff mbox series

Patch

diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index cc9ad6cf02d9..093b1717df01 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -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)