]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.19.33/phy-sun4i-usb-support-set_mode-to-usb_host-for-non-otg-phys.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.19.33 / phy-sun4i-usb-support-set_mode-to-usb_host-for-non-otg-phys.patch
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
5
6 From: Chen-Yu Tsai <wens@csie.org>
7
8 commit 1396929e8a903db80425343cacca766a18ad6409 upstream.
9
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").
15
16 Make set_mode with mode=USB_HOST a no-op instead of failing for the
17 non-OTG USB PHYs.
18
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>
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 @@ -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);
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: