1 From 1396929e8a903db80425343cacca766a18ad6409 Mon Sep 17 00:00:00 2001
2 From: Chen-Yu Tsai <wens@csie.org>
3 Date: Fri, 22 Mar 2019 16:51:07 +0800
4 Subject: phy: sun4i-usb: Support set_mode to USB_HOST for non-OTG PHYs
6 From: Chen-Yu Tsai <wens@csie.org>
8 commit 1396929e8a903db80425343cacca766a18ad6409 upstream.
10 While only the first PHY supports mode switching, the remaining PHYs
11 work in USB host mode. They should support set_mode with mode=USB_HOST
12 instead of failing. This is especially needed now that the USB core does
13 set_mode for all USB ports, which was added in commit b97a31348379 ("usb:
14 core: comply to PHY framework").
16 Make set_mode with mode=USB_HOST a no-op instead of failing for the
19 Fixes: 6ba43c291961 ("phy-sun4i-usb: Add support for phy_set_mode")
20 Signed-off-by: Chen-Yu Tsai <wens@csie.org>
21 Cc: stable <stable@vger.kernel.org>
22 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25 drivers/phy/allwinner/phy-sun4i-usb.c | 5 ++++-
26 1 file changed, 4 insertions(+), 1 deletion(-)
28 --- a/drivers/phy/allwinner/phy-sun4i-usb.c
29 +++ b/drivers/phy/allwinner/phy-sun4i-usb.c
30 @@ -481,8 +481,11 @@ static int sun4i_usb_phy_set_mode(struct
31 struct sun4i_usb_phy_data *data = to_sun4i_usb_phy_data(phy);
34 - if (phy->index != 0)
35 + if (phy->index != 0) {
36 + if (mode == PHY_MODE_USB_HOST)
42 case PHY_MODE_USB_HOST: