Commit 4ac53087 authored by Roger Quadros's avatar Roger Quadros Committed by Greg Kroah-Hartman

usb: xhci: plat: Create both HCDs before adding them

As xhci_hcd is now allocated by usb_create_hcd(), we don't
need to add the primary HCD before creating the shared HCD.

Creating the shared HCD before adding the primary HCD is particularly
useful for the OTG use case so that we know at the OTG core if
the HCD is in single configuration or dual (primary + shared)
configuration.
Signed-off-by: default avatarRoger Quadros <rogerq@ti.com>
[Mathias: rearranged to fit on top of the Marvell Armada 385 phy changes]
Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cd33a321
...@@ -136,21 +136,15 @@ static int xhci_plat_probe(struct platform_device *pdev) ...@@ -136,21 +136,15 @@ static int xhci_plat_probe(struct platform_device *pdev)
goto disable_clk; goto disable_clk;
} }
ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
if (ret)
goto disable_clk;
device_wakeup_enable(hcd->self.controller); device_wakeup_enable(hcd->self.controller);
/* USB 2.0 roothub is stored in the platform_device now. */
hcd = platform_get_drvdata(pdev);
xhci = hcd_to_xhci(hcd); xhci = hcd_to_xhci(hcd);
xhci->clk = clk; xhci->clk = clk;
xhci->shared_hcd = usb_create_shared_hcd(driver, &pdev->dev, xhci->shared_hcd = usb_create_shared_hcd(driver, &pdev->dev,
dev_name(&pdev->dev), hcd); dev_name(&pdev->dev), hcd);
if (!xhci->shared_hcd) { if (!xhci->shared_hcd) {
ret = -ENOMEM; ret = -ENOMEM;
goto dealloc_usb2_hcd; goto disable_clk;
} }
if ((node && of_property_read_bool(node, "usb3-lpm-capable")) || if ((node && of_property_read_bool(node, "usb3-lpm-capable")) ||
...@@ -172,21 +166,26 @@ static int xhci_plat_probe(struct platform_device *pdev) ...@@ -172,21 +166,26 @@ static int xhci_plat_probe(struct platform_device *pdev)
goto put_usb3_hcd; goto put_usb3_hcd;
} }
ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED); ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
if (ret) if (ret)
goto disable_usb_phy; goto disable_usb_phy;
ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
if (ret)
goto dealloc_usb2_hcd;
return 0; return 0;
dealloc_usb2_hcd:
usb_remove_hcd(hcd);
disable_usb_phy: disable_usb_phy:
usb_phy_shutdown(hcd->usb_phy); usb_phy_shutdown(hcd->usb_phy);
put_usb3_hcd: put_usb3_hcd:
usb_put_hcd(xhci->shared_hcd); usb_put_hcd(xhci->shared_hcd);
dealloc_usb2_hcd:
usb_remove_hcd(hcd);
disable_clk: disable_clk:
if (!IS_ERR(clk)) if (!IS_ERR(clk))
clk_disable_unprepare(clk); clk_disable_unprepare(clk);
...@@ -205,9 +204,10 @@ static int xhci_plat_remove(struct platform_device *dev) ...@@ -205,9 +204,10 @@ static int xhci_plat_remove(struct platform_device *dev)
usb_remove_hcd(xhci->shared_hcd); usb_remove_hcd(xhci->shared_hcd);
usb_phy_shutdown(hcd->usb_phy); usb_phy_shutdown(hcd->usb_phy);
usb_put_hcd(xhci->shared_hcd);
usb_remove_hcd(hcd); usb_remove_hcd(hcd);
usb_put_hcd(xhci->shared_hcd);
if (!IS_ERR(clk)) if (!IS_ERR(clk))
clk_disable_unprepare(clk); clk_disable_unprepare(clk);
usb_put_hcd(hcd); usb_put_hcd(hcd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment