usb: ehci: add rockchip relinquishing port quirk support
[firefly-linux-kernel-4.4.55.git] / drivers / usb / host / xhci-plat.c
index 9fe957a1b10c1896ad03f8d94ba9c11e81560785..0f50c1cdea5a5af5aeabef413362e17f4c67e618 100644 (file)
@@ -142,6 +142,9 @@ static int xhci_plat_probe(struct platform_device *pdev)
                ret = clk_prepare_enable(clk);
                if (ret)
                        goto put_hcd;
+       } else if (PTR_ERR(clk) == -EPROBE_DEFER) {
+               ret = -EPROBE_DEFER;
+               goto put_hcd;
        }
 
        if (of_device_is_compatible(pdev->dev.of_node,
@@ -169,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)) {
@@ -192,6 +204,9 @@ static int xhci_plat_probe(struct platform_device *pdev)
        if (ret)
                goto dealloc_usb2_hcd;
 
+       if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
+               xhci->shared_hcd->can_do_streams = 1;
+
        return 0;
 
 
@@ -289,6 +304,7 @@ MODULE_DEVICE_TABLE(acpi, usb_xhci_acpi_match);
 static struct platform_driver usb_xhci_driver = {
        .probe  = xhci_plat_probe,
        .remove = xhci_plat_remove,
+       .shutdown = usb_hcd_platform_shutdown,
        .driver = {
                .name = "xhci-hcd",
                .pm = DEV_PM_OPS,