]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/5.0.6/phy-sun4i-usb-support-set_mode-to-usb_host-for-non-otg-phys.patch
Linux 5.0.6
[thirdparty/kernel/stable-queue.git] / releases / 5.0.6 / phy-sun4i-usb-support-set_mode-to-usb_host-for-non-otg-phys.patch
CommitLineData
955d73e0
GKH
1From 1396929e8a903db80425343cacca766a18ad6409 Mon Sep 17 00:00:00 2001
2From: Chen-Yu Tsai <wens@csie.org>
3Date: Fri, 22 Mar 2019 16:51:07 +0800
4Subject: phy: sun4i-usb: Support set_mode to USB_HOST for non-OTG PHYs
5
6From: Chen-Yu Tsai <wens@csie.org>
7
8commit 1396929e8a903db80425343cacca766a18ad6409 upstream.
9
10While only the first PHY supports mode switching, the remaining PHYs
11work in USB host mode. They should support set_mode with mode=USB_HOST
12instead of failing. This is especially needed now that the USB core does
13set_mode for all USB ports, which was added in commit b97a31348379 ("usb:
14core: comply to PHY framework").
15
16Make set_mode with mode=USB_HOST a no-op instead of failing for the
17non-OTG USB PHYs.
18
19Fixes: 6ba43c291961 ("phy-sun4i-usb: Add support for phy_set_mode")
20Signed-off-by: Chen-Yu Tsai <wens@csie.org>
21Cc: stable <stable@vger.kernel.org>
22Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23
24---
25 drivers/phy/allwinner/phy-sun4i-usb.c | 5 ++++-
26 1 file changed, 4 insertions(+), 1 deletion(-)
27
28--- a/drivers/phy/allwinner/phy-sun4i-usb.c
29+++ b/drivers/phy/allwinner/phy-sun4i-usb.c
30@@ -485,8 +485,11 @@ static int sun4i_usb_phy_set_mode(struct
31 struct sun4i_usb_phy_data *data = to_sun4i_usb_phy_data(phy);
32 int new_mode;
33
34- if (phy->index != 0)
35+ if (phy->index != 0) {
36+ if (mode == PHY_MODE_USB_HOST)
37+ return 0;
38 return -EINVAL;
39+ }
40
41 switch (mode) {
42 case PHY_MODE_USB_HOST: