Merge tag 'lsk-v4.4-17.03-android' of git://git.linaro.org/kernel/linux-linaro-stable.git
[firefly-linux-kernel-4.4.55.git] / drivers / usb / host / xhci-plat.c
index 87a6199dc83c9d26f10f49f44a04a9768641b9e3..cf809492d3893d79381982cb560bba47bdbc8a91 100644 (file)
@@ -172,8 +172,17 @@ static int xhci_plat_probe(struct platform_device *pdev)
                        (pdata && pdata->usb3_lpm_capable))
                xhci->quirks |= XHCI_LPM_SUPPORT;
 
-       if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
-               xhci->shared_hcd->can_do_streams = 1;
+       if (pdata && pdata->usb3_disable_autosuspend)
+               xhci->quirks |= XHCI_DIS_AUTOSUSPEND;
+
+       xhci->shared_hcd->usb_phy = devm_usb_get_phy(&pdev->dev,
+                                                    USB_PHY_TYPE_USB3);
+       if (IS_ERR(xhci->shared_hcd->usb_phy)) {
+               ret = PTR_ERR(xhci->shared_hcd->usb_phy);
+               if (ret == -EPROBE_DEFER)
+                       goto put_usb3_hcd;
+               xhci->shared_hcd->usb_phy = NULL;
+       }
 
        hcd->usb_phy = devm_usb_get_phy_by_phandle(&pdev->dev, "usb-phy", 0);
        if (IS_ERR(hcd->usb_phy)) {
@@ -191,10 +200,16 @@ static int xhci_plat_probe(struct platform_device *pdev)
        if (ret)
                goto disable_usb_phy;
 
+       if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
+               xhci->shared_hcd->can_do_streams = 1;
+
        ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
        if (ret)
                goto dealloc_usb2_hcd;
 
+       if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
+               xhci->shared_hcd->can_do_streams = 1;
+
        return 0;
 
 
@@ -223,6 +238,8 @@ static int xhci_plat_remove(struct platform_device *dev)
        struct xhci_hcd *xhci = hcd_to_xhci(hcd);
        struct clk *clk = xhci->clk;
 
+       xhci->xhc_state |= XHCI_STATE_REMOVING;
+
        usb_remove_hcd(xhci->shared_hcd);
        usb_phy_shutdown(hcd->usb_phy);