Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1707016 > unrolled thread

[PATCH v2] usb: dwc2: skip L2 state of hcd if work in device mode

Started byMeng Dongyang <daniel.meng@rock-chips.com>
First post2017-08-09 04:40 +0200
Last post2017-08-09 04:40 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] usb: dwc2: skip L2 state of hcd if work in device mode Meng Dongyang <daniel.meng@rock-chips.com> - 2017-08-09 04:40 +0200
    [PATCH v2] usb: dwc2: skip L2 state of hcd if controller work in device mode Meng Dongyang <daniel.meng@rock-chips.com> - 2017-08-09 04:40 +0200

#1707016 — [PATCH v2] usb: dwc2: skip L2 state of hcd if work in device mode

FromMeng Dongyang <daniel.meng@rock-chips.com>
Date2017-08-09 04:40 +0200
Subject[PATCH v2] usb: dwc2: skip L2 state of hcd if work in device mode
Message-ID<ucp4B-Fu-7@gated-at.bofh.it>
The gadget may fail to enqueue request if the controller has enter L2
state. This patch prevent enter L2 state in hcd driver if the controller
works in device mode.

Change in v2:None, resend to addition maintainer

Meng Dongyang (1):
  usb: dwc2: skip L2 state of hcd if controller work in device mode

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

-- 
1.9.1

[toc] | [next] | [standalone]


#1707018 — [PATCH v2] usb: dwc2: skip L2 state of hcd if controller work in device mode

FromMeng Dongyang <daniel.meng@rock-chips.com>
Date2017-08-09 04:40 +0200
Subject[PATCH v2] usb: dwc2: skip L2 state of hcd if controller work in device mode
Message-ID<ucp4B-Fu-13@gated-at.bofh.it>
In reply to#1707016
In the case hcd autosuspend is enabled, the hcd will enter L2 state
if no device connected. But if the controller works in otg mode, the
gadget driver still works in L0 state if connected with host. This
may result in transfer fail when gadget enqueue new request but the
hcd driver has set the global state into L2. This patch prevent the
hcd enter L2 state if the controller work in device mode.

Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
---

Changes in v2:None

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

diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index 740c7e8..c263114 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -4388,6 +4388,9 @@ static int _dwc2_hcd_suspend(struct usb_hcd *hcd)
 
 	spin_lock_irqsave(&hsotg->lock, flags);
 
+	if (dwc2_is_device_mode(hsotg))
+		goto unlock;
+
 	if (hsotg->lx_state != DWC2_L0)
 		goto unlock;
 
@@ -4446,6 +4449,9 @@ static int _dwc2_hcd_resume(struct usb_hcd *hcd)
 
 	spin_lock_irqsave(&hsotg->lock, flags);
 
+	if (dwc2_is_device_mode(hsotg))
+		goto unlock;
+
 	if (hsotg->lx_state != DWC2_L2)
 		goto unlock;
 
-- 
1.9.1

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web