From: Stanley Chang Date: Fri, 7 Apr 2023 06:07:31 +0000 (+0800) Subject: usb: xhci: plat: Add USB 3.0 phy support X-Git-Tag: v6.6.7~2985^2~38 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9134c1fd05034dd29a1a2f010abd178af409171e;p=platform%2Fkernel%2Flinux-starfive.git 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 Link: https://lore.kernel.org/r/20230407060731.20537-1-stanley_chang@realtek.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 76c5a84..b0c8e8e 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -291,6 +291,21 @@ int xhci_plat_probe(struct platform_device *pdev, struct device *sysdev, const s goto dealloc_usb2_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); + } + xhci->shared_hcd->tpl_support = hcd->tpl_support; }