usb: host: xhci-plat: create shared hcd after having added main hcd
This patch is in preparation of an extension where in case of a root hub with no ports no shared hcd will be created. Whether one of the root hubs has no ports we figure our in usb_add_hcd() for the primary hcd. Therefore create the shared hcd only after this call. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20220511220450.85367-4-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
873f323618
commit
0cf1ea040a
@@ -283,12 +283,6 @@ static int xhci_plat_probe(struct platform_device *pdev)
|
|||||||
device_set_wakeup_capable(&pdev->dev, true);
|
device_set_wakeup_capable(&pdev->dev, true);
|
||||||
|
|
||||||
xhci->main_hcd = hcd;
|
xhci->main_hcd = hcd;
|
||||||
xhci->shared_hcd = __usb_create_hcd(driver, sysdev, &pdev->dev,
|
|
||||||
dev_name(&pdev->dev), hcd);
|
|
||||||
if (!xhci->shared_hcd) {
|
|
||||||
ret = -ENOMEM;
|
|
||||||
goto disable_clk;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* imod_interval is the interrupt moderation value in nanoseconds. */
|
/* imod_interval is the interrupt moderation value in nanoseconds. */
|
||||||
xhci->imod_interval = 40000;
|
xhci->imod_interval = 40000;
|
||||||
@@ -313,16 +307,16 @@ static int xhci_plat_probe(struct platform_device *pdev)
|
|||||||
if (IS_ERR(hcd->usb_phy)) {
|
if (IS_ERR(hcd->usb_phy)) {
|
||||||
ret = PTR_ERR(hcd->usb_phy);
|
ret = PTR_ERR(hcd->usb_phy);
|
||||||
if (ret == -EPROBE_DEFER)
|
if (ret == -EPROBE_DEFER)
|
||||||
goto put_usb3_hcd;
|
goto disable_clk;
|
||||||
hcd->usb_phy = NULL;
|
hcd->usb_phy = NULL;
|
||||||
} else {
|
} else {
|
||||||
ret = usb_phy_init(hcd->usb_phy);
|
ret = usb_phy_init(hcd->usb_phy);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto put_usb3_hcd;
|
goto disable_clk;
|
||||||
}
|
}
|
||||||
|
|
||||||
hcd->tpl_support = of_usb_host_tpl_support(sysdev->of_node);
|
hcd->tpl_support = of_usb_host_tpl_support(sysdev->of_node);
|
||||||
xhci->shared_hcd->tpl_support = hcd->tpl_support;
|
|
||||||
if (priv && (priv->quirks & XHCI_SKIP_PHY_INIT))
|
if (priv && (priv->quirks & XHCI_SKIP_PHY_INIT))
|
||||||
hcd->skip_phy_initialization = 1;
|
hcd->skip_phy_initialization = 1;
|
||||||
|
|
||||||
@@ -333,12 +327,21 @@ static int xhci_plat_probe(struct platform_device *pdev)
|
|||||||
if (ret)
|
if (ret)
|
||||||
goto disable_usb_phy;
|
goto disable_usb_phy;
|
||||||
|
|
||||||
|
xhci->shared_hcd = __usb_create_hcd(driver, sysdev, &pdev->dev,
|
||||||
|
dev_name(&pdev->dev), hcd);
|
||||||
|
if (!xhci->shared_hcd) {
|
||||||
|
ret = -ENOMEM;
|
||||||
|
goto dealloc_usb2_hcd;
|
||||||
|
}
|
||||||
|
|
||||||
|
xhci->shared_hcd->tpl_support = hcd->tpl_support;
|
||||||
|
|
||||||
if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
|
if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
|
||||||
xhci->shared_hcd->can_do_streams = 1;
|
xhci->shared_hcd->can_do_streams = 1;
|
||||||
|
|
||||||
ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
|
ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto dealloc_usb2_hcd;
|
goto put_usb3_hcd;
|
||||||
|
|
||||||
device_enable_async_suspend(&pdev->dev);
|
device_enable_async_suspend(&pdev->dev);
|
||||||
pm_runtime_put_noidle(&pdev->dev);
|
pm_runtime_put_noidle(&pdev->dev);
|
||||||
@@ -352,15 +355,15 @@ static int xhci_plat_probe(struct platform_device *pdev)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
|
put_usb3_hcd:
|
||||||
|
usb_put_hcd(xhci->shared_hcd);
|
||||||
|
|
||||||
dealloc_usb2_hcd:
|
dealloc_usb2_hcd:
|
||||||
usb_remove_hcd(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:
|
|
||||||
usb_put_hcd(xhci->shared_hcd);
|
|
||||||
|
|
||||||
disable_clk:
|
disable_clk:
|
||||||
clk_disable_unprepare(xhci->clk);
|
clk_disable_unprepare(xhci->clk);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user