BACKPORT: usb: xhci: plat: Add USB 3.0 phy support

For Realtek SoC, the usb xhci uses different driver for u2phy and u3phy.
Therefore, add a hook to retrieve the USB 3.0 PHY to XHCI plat.

Signed-off-by: Stanley Chang <stanley_chang@realtek.com>
Link: https://lore.kernel.org/r/20230407060731.20537-1-stanley_chang@realtek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 286930662
(cherry picked from commit 9134c1fd05
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git master)
Change-Id: I5dfaebcb5090050ed01a2aca06b5b27993cb1edb
Signed-off-by: Stanley Chang <stanley_chang@realtek.com>
This commit is contained in:
Stanley Chang
2023-04-07 14:07:31 +08:00
committed by Greg Kroah-Hartman
parent 7b23f0d62a
commit 4b219f7fc9

View File

@@ -339,6 +339,19 @@ static int xhci_plat_probe(struct platform_device *pdev)
goto put_usb3_hcd;
}
xhci->shared_hcd->usb_phy = devm_usb_get_phy_by_phandle(sysdev, "usb-phy", 1);
if (IS_ERR(xhci->shared_hcd->usb_phy)) {
if (PTR_ERR(xhci->shared_hcd->usb_phy) != -ENODEV)
dev_err(sysdev, "%s get usb3phy fail (ret=%d)\n", __func__,
(int)PTR_ERR(xhci->shared_hcd->usb_phy));
xhci->shared_hcd->usb_phy = NULL;
} else {
ret = usb_phy_init(xhci->shared_hcd->usb_phy);
if (ret)
dev_err(sysdev, "%s init usb3phy fail (ret=%d)\n",
__func__, ret);
}
hcd->tpl_support = of_usb_host_tpl_support(sysdev->of_node);
xhci->shared_hcd->tpl_support = hcd->tpl_support;