[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1587472341-17935-2-git-send-email-fabrice.gasnier@st.com>
Date: Tue, 21 Apr 2020 14:32:18 +0200
From: Fabrice Gasnier <fabrice.gasnier@...com>
To: <hminas@...opsys.com>, <balbi@...nel.org>
CC: <gregkh@...uxfoundation.org>, <linux-usb@...r.kernel.org>,
<linux-kernel@...r.kernel.org>,
<linux-stm32@...md-mailman.stormreply.com>,
<amelie.delaunay@...com>
Subject: [PATCH 1/4] usb: dwc2: gadget: move gadget resume after the core is in L0 state
When the remote wakeup interrupt is triggered, lx_state is resumed from L2
to L0 state. But when the gadget resume is called, lx_state is still L2.
This prevents the resume callback to queue any request. Any attempt
to queue a request from resume callback will result in:
- "submit request only in active state" debug message to be issued
- dwc2_hsotg_ep_queue() returns -EAGAIN
Move the call to resume gadget after the core is put in DWC2_L0 state.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@...com>
---
drivers/usb/dwc2/core_intr.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c
index 876ff31..b8ebda5 100644
--- a/drivers/usb/dwc2/core_intr.c
+++ b/drivers/usb/dwc2/core_intr.c
@@ -404,9 +404,11 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg)
}
if (dwc2_is_device_mode(hsotg)) {
+ enum dwc2_lx_state lx_state = hsotg->lx_state;
+
dev_dbg(hsotg->dev, "DSTS=0x%0x\n",
dwc2_readl(hsotg, DSTS));
- if (hsotg->lx_state == DWC2_L2) {
+ if (lx_state == DWC2_L2) {
u32 dctl = dwc2_readl(hsotg, DCTL);
/* Clear Remote Wakeup Signaling */
@@ -415,11 +417,13 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg)
ret = dwc2_exit_partial_power_down(hsotg, true);
if (ret && (ret != -ENOTSUPP))
dev_err(hsotg->dev, "exit power_down failed\n");
-
- call_gadget(hsotg, resume);
}
/* Change to L0 state */
hsotg->lx_state = DWC2_L0;
+
+ /* Gadget may queue new requests upon resume to L0 state */
+ if (lx_state == DWC2_L2)
+ call_gadget(hsotg, resume);
} else {
if (hsotg->params.power_down)
return;
--
2.7.4
Powered by blists - more mailing lists