linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Crispin <john@phrozen.org>
To: Minas Harutyunyan <hminas@synopsys.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, Serge Vasilugin <vasilugin@yandex.ru>,
	John Crispin <john@phrozen.org>
Subject: [PATCH/RFC] usb: dwc2: awake rt305x USB controller
Date: Fri, 20 Jul 2018 14:05:58 +0200	[thread overview]
Message-ID: <20180720120558.8831-1-john@phrozen.org> (raw)

From: Serge Vasilugin <vasilugin@yandex.ru>

The Ralink uboot sets the USB controller into sleep mode. This patch checks
this condition and awakes controller before any register access.

Signed-off-by: Serge Vasilugin <vasilugin@yandex.ru>
Signed-off-by: John Crispin <john@phrozen.org>
---
Hi,
we have been carrying this patch inside OpenWrt for half a decade. The
USB driver that is included in the Ralink SDK does a mdelay(25) after
this call but it works without apparently.
	John

 drivers/usb/dwc2/platform.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index 4c0819554bcd..0bc9fd65e29e 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -419,6 +419,10 @@ static int dwc2_driver_probe(struct platform_device *dev)
 	if (retval)
 		return retval;
 
+	/* Enable USB port before any regs access */
+	if (dwc2_readl(hsotg->regs + PCGCTL) & 0x0f)
+		dwc2_writel(0x00, hsotg->regs + PCGCTL);
+
 	retval = dwc2_get_dr_mode(hsotg);
 	if (retval)
 		goto error;

                 reply	other threads:[~2018-07-20 12:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20180720120558.8831-1-john@phrozen.org \
    --to=john@phrozen.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hminas@synopsys.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=vasilugin@yandex.ru \
    /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).