From: Douglas Anderson <dianders@chromium.org>
To: John Youn <John.Youn@synopsys.com>
Cc: "Yunzhi Li" <lyz@rock-chips.com>,
"Heiko Stübner" <heiko@sntech.de>,
linux-rockchip@lists.infradead.org,
"Julius Werner" <jwerner@chromium.org>,
"Douglas Anderson" <dianders@chromium.org>,
johnyoun@synopsys.com, gregkh@linuxfoundation.org,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/5] usb: dwc2: reset dwc2 core before dwc2_get_hwparams()
Date: Wed, 7 Oct 2015 17:48:38 -0700 [thread overview]
Message-ID: <1444265321-16768-3-git-send-email-dianders@chromium.org> (raw)
In-Reply-To: <1444265321-16768-1-git-send-email-dianders@chromium.org>
From: Yunzhi Li <lyz@rock-chips.com>
We initiate dwc2 usb controller in BIOS, dwc2_core_reset() should
be called before dwc2_get_hwparams() to reset core registers to
default value. Without this the FIFO setting might be incorrect
because calculating FIFO size need power-on value of
GRXFSIZ/GNPTXFSIZ/HPTXFSIZ registers.
This patch could avoid warnning massage like in rk3288 platform:
[ 2.074764] dwc2 ff580000.usb: 256 invalid for
host_perio_tx_fifo_size. Check HW configuration.
Signed-off-by: Yunzhi Li <lyz@rock-chips.com>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---
drivers/usb/dwc2/core.c | 2 +-
drivers/usb/dwc2/core.h | 1 +
drivers/usb/dwc2/platform.c | 6 ++++++
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
index 43c8bf4..f2002d2 100644
--- a/drivers/usb/dwc2/core.c
+++ b/drivers/usb/dwc2/core.c
@@ -481,7 +481,7 @@ static void dwc2_init_fs_ls_pclk_sel(struct dwc2_hsotg *hsotg)
* Do core a soft reset of the core. Be careful with this because it
* resets all the internal state machines of the core.
*/
-static int dwc2_core_reset(struct dwc2_hsotg *hsotg)
+int dwc2_core_reset(struct dwc2_hsotg *hsotg)
{
u32 greset;
int count = 0;
diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index ebf2504..c258d19 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -862,6 +862,7 @@ enum dwc2_halt_status {
* The following functions support initialization of the core driver component
* and the DWC_otg controller
*/
+extern int dwc2_core_reset(struct dwc2_hsotg *hsotg);
extern void dwc2_core_host_init(struct dwc2_hsotg *hsotg);
extern int dwc2_enter_hibernation(struct dwc2_hsotg *hsotg);
extern int dwc2_exit_hibernation(struct dwc2_hsotg *hsotg, bool restore);
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index b920e43..d27521c 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -254,6 +254,12 @@ static int dwc2_driver_probe(struct platform_device *dev)
spin_lock_init(&hsotg->lock);
mutex_init(&hsotg->init_mutex);
+ /*
+ * Reset before dwc2_get_hwparams() then it could get power-on real
+ * reset value form registers.
+ */
+ dwc2_core_reset(hsotg);
+
/* Detect config values from hardware */
retval = dwc2_get_hwparams(hsotg);
if (retval)
--
2.6.0.rc2.230.g3dd15c0
next prev parent reply other threads:[~2015-10-08 0:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-08 0:48 [PATCH 0/5] usb: dwc2: fix dwc2_get_hwparams() + optimize probe time a bit Douglas Anderson
2015-10-08 0:48 ` [PATCH 1/5] usb: dwc2: Restore GUSBCFG in dwc2_get_hwparams() Douglas Anderson
2015-10-08 0:48 ` Douglas Anderson [this message]
2015-10-08 0:48 ` [PATCH 3/5] CHROMIUM: usb: dwc2: Avoid double-reset at boot time Douglas Anderson
2015-10-08 17:34 ` Doug Anderson
2015-10-08 0:48 ` [PATCH 4/5] usb: dwc2: Speed dwc2_get_hwparams() on some host-only ports Douglas Anderson
2015-10-08 0:48 ` [PATCH 5/5] usb: dwc2: reduce dwc2 driver probe time Douglas Anderson
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=1444265321-16768-3-git-send-email-dianders@chromium.org \
--to=dianders@chromium.org \
--cc=John.Youn@synopsys.com \
--cc=gregkh@linuxfoundation.org \
--cc=heiko@sntech.de \
--cc=johnyoun@synopsys.com \
--cc=jwerner@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=lyz@rock-chips.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).