From: Chen-Yu Tsai <wens@kernel.org>
To: Maxime Ripard <maxime.ripard@bootlin.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Grygorii Strashko <grygorii.strashko@ti.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>,
linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [BUG] USB (EHCI/OHCI) broken on Allwinner SoCs
Date: Mon, 18 Mar 2019 16:45:36 +0800 [thread overview]
Message-ID: <20190318084536.GA27150@wens.csie.org> (raw)
Hi everyone,
USB EHCI/OHCI hosts are broken on Allwinner SoCs on v5.1-rc1. I believe
this is partially triggered by commit b97a31348379 ("usb: core: comply
to PHY framework"), and partially due to how the Allwinner USB PHY
driver handles phy_set_mode for non-OTG PHYs. Note this is not from a
bisect.
The following changes fix this.
Hunk 1 makes our PHY driver accept PHY_MODE_USB_HOST for the non-OTG
PHYs as a no-op.
diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c
index 5163097b43df..4bbd9ede38c8 100644
--- a/drivers/phy/allwinner/phy-sun4i-usb.c
+++ b/drivers/phy/allwinner/phy-sun4i-usb.c
@@ -485,8 +485,11 @@ static int sun4i_usb_phy_set_mode(struct phy *_phy,
struct sun4i_usb_phy_data *data = to_sun4i_usb_phy_data(phy);
int new_mode;
- if (phy->index != 0)
+ if (phy->index != 0) {
+ if (mode == PHY_MODE_USB_HOST)
+ return 0;
return -EINVAL;
+ }
switch (mode) {
case PHY_MODE_USB_HOST:
---
Hunk 2 makes the USB core call phy_set_mode with PHY_MODE_USB_HOST
instead of PHY_MODE_USB_HOST_SS. Not sure why PHY_MODE_USB_HOST_SS was
used here, but I believe only a small set of hardware actually support
SuperSpeed, so it might be better to use the more encompasing
PHY_MODE_USB_HOST. That or the core code would have to check which speed
class the port is for and pass in the appropriate mode. The Allwinner
PHYs do not support SuperSpeed.
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 3189181bb628..7f25e384144d 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2740,7 +2740,7 @@ int usb_add_hcd(struct usb_hcd *hcd,
return retval;
retval = usb_phy_roothub_set_mode(hcd->phy_roothub,
- PHY_MODE_USB_HOST_SS);
+ PHY_MODE_USB_HOST);
if (retval)
goto err_usb_phy_roothub_power_on;
---
If the two changes make sense I'll send them out as actual patches.
reply other threads:[~2019-03-18 8:45 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=20190318084536.GA27150@wens.csie.org \
--to=wens@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=grygorii.strashko@ti.com \
--cc=kishon@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=maxime.ripard@bootlin.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
all inboxes | Powered by JetHome®