mediatek: backport upstream mediatek patches
[openwrt/staging/chunkeey.git] / target / linux / mediatek / patches-4.14 / 0110-usb-mtu3-get-optional-vbus-for-host-only-mode.patch
1 From b6712b72d1273e792ee8a533048ba731a3709163 Mon Sep 17 00:00:00 2001
2 From: Chunfeng Yun <chunfeng.yun@mediatek.com>
3 Date: Fri, 13 Oct 2017 17:10:44 +0800
4 Subject: [PATCH 110/224] usb: mtu3: get optional vbus for host only mode
5
6 When dr_mode is set as USB_DR_MODE_HOST, it's better to try to
7 get optional vbus, this can increase flexibility, although we
8 can set vbus as always on for regulator or put it in host driver
9 to turn it on.
10
11 Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
12 Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
13 ---
14 drivers/usb/mtu3/mtu3_plat.c | 8 ++++----
15 1 file changed, 4 insertions(+), 4 deletions(-)
16
17 diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
18 index 1e473b068650..7ca81f4e78a3 100644
19 --- a/drivers/usb/mtu3/mtu3_plat.c
20 +++ b/drivers/usb/mtu3/mtu3_plat.c
21 @@ -300,10 +300,6 @@ static int get_ssusb_rscs(struct platform_device *pdev, struct ssusb_mtk *ssusb)
22 of_property_read_u32(node, "mediatek,u3p-dis-msk",
23 &ssusb->u3p_dis_msk);
24
25 - if (ssusb->dr_mode != USB_DR_MODE_OTG)
26 - return 0;
27 -
28 - /* if dual-role mode is supported */
29 vbus = devm_regulator_get(&pdev->dev, "vbus");
30 if (IS_ERR(vbus)) {
31 dev_err(dev, "failed to get vbus\n");
32 @@ -311,6 +307,10 @@ static int get_ssusb_rscs(struct platform_device *pdev, struct ssusb_mtk *ssusb)
33 }
34 otg_sx->vbus = vbus;
35
36 + if (ssusb->dr_mode == USB_DR_MODE_HOST)
37 + return 0;
38 +
39 + /* if dual-role mode is supported */
40 otg_sx->is_u3_drd = of_property_read_bool(node, "mediatek,usb3-drd");
41 otg_sx->manual_drd_enabled =
42 of_property_read_bool(node, "enable-manual-drd");
43 --
44 2.11.0
45