From: Chen-Yu Tsai <wens@kernel•org>
To: Maxime Ripard <maxime.ripard@bootlin•com>,
Greg Kroah-Hartman <gregkh@linuxfoundation•org>,
Kishon Vijay Abraham I <kishon@ti•com>
Cc: Chen-Yu Tsai <wens@csie•org>,
Grygorii Strashko <grygorii.strashko@ti•com>,
linux-usb@vger•kernel.org, linux-arm-kernel@lists•infradead.org,
linux-kernel@vger•kernel.org
Subject: [PATCH 1/2] phy: sun4i-usb: Support set_mode to USB_HOST for non-OTG PHYs
Date: Fri, 22 Mar 2019 16:51:07 +0800 [thread overview]
Message-ID: <20190322085108.18693-2-wens@kernel.org> (raw)
In-Reply-To: <20190322085108.18693-1-wens@kernel.org>
From: Chen-Yu Tsai <wens@csie•org>
While only the first PHY supports mode switching, the remaining PHYs
work in USB host mode. They should support set_mode with mode=USB_HOST
instead of failing. This is especially needed now that the USB core does
set_mode for all USB ports, which was added in commit b97a31348379 ("usb:
core: comply to PHY framework").
Make set_mode with mode=USB_HOST a no-op instead of failing for the
non-OTG USB PHYs.
Fixes: 6ba43c291961 ("phy-sun4i-usb: Add support for phy_set_mode")
Signed-off-by: Chen-Yu Tsai <wens@csie•org>
---
drivers/phy/allwinner/phy-sun4i-usb.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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:
--
2.20.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-03-22 8:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-22 8:51 [PATCH 0/2] ARM: sunxi: Fix USB host init fail on v5.1-rc1 Chen-Yu Tsai
2019-03-22 8:51 ` Chen-Yu Tsai [this message]
2019-03-22 8:51 ` [PATCH 2/2] usb: core: Try generic PHY_MODE_USB_HOST if usb_phy_roothub_set_mode fails Chen-Yu Tsai
2019-03-22 12:56 ` Neil Armstrong
2019-03-22 9:05 ` [PATCH 0/2] ARM: sunxi: Fix USB host init fail on v5.1-rc1 Maxime Ripard
2019-03-26 7:49 ` Greg Kroah-Hartman
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=20190322085108.18693-2-wens@kernel.org \
--to=wens@kernel$(echo .)org \
--cc=gregkh@linuxfoundation$(echo .)org \
--cc=grygorii.strashko@ti$(echo .)com \
--cc=kishon@ti$(echo .)com \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-usb@vger$(echo .)kernel.org \
--cc=maxime.ripard@bootlin$(echo .)com \
--cc=wens@csie$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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