From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] usb: ehci: call platform init before ehci reset
Date: Fri, 19 Oct 2018 14:07:50 +0200 [thread overview]
Message-ID: <20181019120750.809-1-u.kleine-koenig@pengutronix.de> (raw)
On i.MX25 platform init sets up things like the polarity of the
overcurrent pin. If the reset default value is still wrong at ehci_reset
time, this results in an overcurrent event being pending in the hardware
even if the pin is actually in it's inactive level. To prevent this call
platform init before ehci_reset().
Without this change barebox fails to correctly handle the imagined
overcurrent event resulting in the inability to access the contents of
an USB thumb drive. So there must be another problem somewhere, but I
didn't debug that. The change introduced in this patch works around this
problem but is correct on its own anyhow.
Note there is a chance that other platforms rely on the previous order,
I'm not aware of actual problems though.
The problem was debugged with Michael Grzeschik, thanks to him for his
valuable aid.
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/usb/host/ehci-hcd.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 9bbdda365c01..18ff6b589773 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -801,16 +801,16 @@ static int ehci_init(struct usb_host *host)
ehci_halt(ehci);
- /* EHCI spec section 4.1 */
- if (ehci_reset(ehci) != 0)
- return -1;
-
if (ehci->init) {
ret = ehci->init(ehci->drvdata);
if (ret)
return ret;
}
+ /* EHCI spec section 4.1 */
+ if (ehci_reset(ehci) != 0)
+ return -1;
+
memset(ehci->qh_list, 0, sizeof(struct QH) * NUM_TD);
ehci->qh_list->qh_link = cpu_to_hc32((uint32_t)ehci->qh_list | QH_LINK_TYPE_QH);
--
2.19.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2018-10-19 12:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-19 12:07 Uwe Kleine-König [this message]
2018-10-19 12:33 ` Sascha Hauer
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=20181019120750.809-1-u.kleine-koenig@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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