Patchwork [05/14] usb: dwc2: Add port conn. sts. checking in _dwc2_hcd_resume() function.

login
register
mail settings
Submitter Artur Petrosyan
Date April 12, 2019, 1:39 p.m.
Message ID <a62d19d1de98326fbb7b39fb74f1a65bab30097b.1555075928.git.arturp@synopsys.com>
Download mbox | patch
Permalink /patch/771835/
State New
Headers show

Comments

Artur Petrosyan - April 12, 2019, 1:39 p.m.
Added port connection status checking which prevents exiting from
Partial Power Down mode from _dwc2_hcd_resume() when no entering
to Partial Power Down mode happened.

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

---
 drivers/usb/dwc2/hcd.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

-- 
2.11.0

Patch

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

index 1d18258b5ff8..8367902a47eb 100644

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

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

@@ -4544,6 +4544,9 @@  static int _dwc2_hcd_resume(struct usb_hcd *hcd)

 	struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd);
 	unsigned long flags;
 	int ret = 0;
+	u32 hprt0;

+

+	hprt0 = dwc2_read_hprt0(hsotg);

 
 	spin_lock_irqsave(&hsotg->lock, flags);
 
@@ -4553,7 +4556,8 @@  static int _dwc2_hcd_resume(struct usb_hcd *hcd)

 	if (hsotg->lx_state != DWC2_L2)
 		goto unlock;
 
-	if (hsotg->params.power_down != DWC2_POWER_DOWN_PARAM_PARTIAL) {

+	if (hsotg->params.power_down != DWC2_POWER_DOWN_PARAM_PARTIAL ||

+	    hprt0 & HPRT0_CONNSTS) {

 		hsotg->lx_state = DWC2_L0;
 		goto unlock;
 	}