From: Baolin Wang <baolin.wang@linaro.org>
To: balbi@kernel.org, gregkh@linuxfoundation.org
Cc: mathias.nyman@intel.com, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, broonie@kernel.org,
baolin.wang@linaro.org
Subject: [PATCH 3/4] usb: dwc3: core: Move the mode setting to the right place
Date: Fri, 15 Jul 2016 17:13:27 +0800 [thread overview]
Message-ID: <17d90b25eaefb22d92f2f55a3fd750da8be368fc.1468571634.git.baolin.wang@linaro.org> (raw)
In-Reply-To: <cover.1468571634.git.baolin.wang@linaro.org>
In-Reply-To: <cover.1468571634.git.baolin.wang@linaro.org>
When dwc3 core enters into suspend mode, the system (especially for mobile
device) may power off the dwc3 controller for power saving, that will cause
dwc3 controller lost the mode operation when resuming dwc3 core.
Thus we can move the mode setting into dwc3_core_init() function to avoid this
issue.
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
drivers/usb/dwc3/core.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 9466431..1485480 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -666,6 +666,21 @@ static int dwc3_core_init(struct dwc3 *dwc)
goto err4;
}
+ switch (dwc->dr_mode) {
+ case USB_DR_MODE_PERIPHERAL:
+ dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE);
+ break;
+ case USB_DR_MODE_HOST:
+ dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_HOST);
+ break;
+ case USB_DR_MODE_OTG:
+ dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_OTG);
+ break;
+ default:
+ dev_warn(dwc->dev, "Unsupported mode %d\n", dwc->dr_mode);
+ break;
+ }
+
return 0;
err4:
@@ -763,7 +778,6 @@ static int dwc3_core_init_mode(struct dwc3 *dwc)
switch (dwc->dr_mode) {
case USB_DR_MODE_PERIPHERAL:
- dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE);
ret = dwc3_gadget_init(dwc);
if (ret) {
if (ret != -EPROBE_DEFER)
@@ -772,7 +786,6 @@ static int dwc3_core_init_mode(struct dwc3 *dwc)
}
break;
case USB_DR_MODE_HOST:
- dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_HOST);
ret = dwc3_host_init(dwc);
if (ret) {
if (ret != -EPROBE_DEFER)
@@ -781,7 +794,6 @@ static int dwc3_core_init_mode(struct dwc3 *dwc)
}
break;
case USB_DR_MODE_OTG:
- dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_OTG);
ret = dwc3_host_init(dwc);
if (ret) {
if (ret != -EPROBE_DEFER)
--
1.7.9.5
next prev parent reply other threads:[~2016-07-15 9:14 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-15 9:13 [PATCH 0/4] Support dwc3 host suspend/resume Baolin Wang
2016-07-15 9:13 ` [PATCH 1/4] usb: host: xhci: Move the xhci quirks checking to the right place Baolin Wang
2016-08-18 7:17 ` Felipe Balbi
2016-08-30 12:04 ` Baolin Wang
2016-07-15 9:13 ` [PATCH 2/4] usb: host: xhci: Introduce one new 'usb3_slow_suspend' member for xhci private data Baolin Wang
2016-08-18 7:18 ` Felipe Balbi
2016-08-18 8:54 ` Baolin Wang
2016-08-18 12:25 ` Felipe Balbi
2016-08-18 12:47 ` Baolin Wang
2016-08-18 13:42 ` Felipe Balbi
2016-08-19 7:52 ` Baolin Wang
2016-07-15 9:13 ` Baolin Wang [this message]
2016-07-15 9:13 ` [PATCH 4/4] usb: dwc3: core: Support the dwc3 host suspend/resume Baolin Wang
2016-07-15 16:17 ` kbuild test robot
2016-07-15 18:25 ` kbuild test robot
2016-08-18 7:33 ` Felipe Balbi
2016-08-18 8:59 ` Baolin Wang
2016-08-18 12:25 ` Felipe Balbi
2016-08-18 12:52 ` Baolin Wang
2016-08-18 13:42 ` Felipe Balbi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=17d90b25eaefb22d92f2f55a3fd750da8be368fc.1468571634.git.baolin.wang@linaro.org \
--to=baolin.wang@linaro.org \
--cc=balbi@kernel.org \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).