Merge pull request #580 from wigyori/cc-libpcap
[15.05/openwrt.git] / target / linux / mvebu / patches-3.18 / 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 @@ -161,12 +162,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 @@ -192,6 +208,7 @@ static int xhci_plat_remove(struct platf
41         xhci->xhc_state |= XHCI_STATE_REMOVING;
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);