a315b8775f70fcff24426ae6656701f481fa074e
[openwrt/openwrt.git] / target / linux / mvebu / patches-4.0 / 700-usb_xhci_plat_phy_support.patch
1 --- a/drivers/usb/host/xhci-plat.c
2 +++ b/drivers/usb/host/xhci-plat.c
3 @@ -16,6 +16,7 @@
4 #include <linux/module.h>
5 #include <linux/of.h>
6 #include <linux/platform_device.h>
7 +#include <linux/usb/phy.h>
8 #include <linux/slab.h>
9 #include <linux/usb/xhci_pdriver.h>
10
11 @@ -155,12 +156,27 @@ static int xhci_plat_probe(struct platfo
12 if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
13 xhci->shared_hcd->can_do_streams = 1;
14
15 + hcd->usb_phy = devm_usb_get_phy_by_phandle(&pdev->dev, "usb-phy", 0);
16 + if (IS_ERR(hcd->usb_phy)) {
17 + ret = PTR_ERR(hcd->usb_phy);
18 + if (ret == -EPROBE_DEFER)
19 + goto put_usb3_hcd;
20 + hcd->usb_phy = NULL;
21 + } else {
22 + ret = usb_phy_init(hcd->usb_phy);
23 + if (ret)
24 + goto put_usb3_hcd;
25 + }
26 +
27 ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
28 if (ret)
29 - goto put_usb3_hcd;
30 + goto disable_usb_phy;
31
32 return 0;
33
34 +disable_usb_phy:
35 + usb_phy_shutdown(hcd->usb_phy);
36 +
37 put_usb3_hcd:
38 usb_put_hcd(xhci->shared_hcd);
39
40 @@ -184,6 +200,7 @@ static int xhci_plat_remove(struct platf
41 struct clk *clk = xhci->clk;
42
43 usb_remove_hcd(xhci->shared_hcd);
44 + usb_phy_shutdown(hcd->usb_phy);
45 usb_put_hcd(xhci->shared_hcd);
46
47 usb_remove_hcd(hcd);