Merge "xhci-plat: Use correct dev to get usb-phy handle"
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 0ce6929..a1dedf0 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -193,7 +193,7 @@
{
const struct of_device_id *match;
const struct hc_driver *driver;
- struct device *sysdev;
+ struct device *sysdev, *phydev;
struct xhci_hcd *xhci;
struct resource *res;
struct usb_hcd *hcd;
@@ -220,6 +220,9 @@
* 3. xhci_plat is grandchild of a pci device (dwc3-pci)
*/
sysdev = &pdev->dev;
+ phydev = &pdev->dev;
+ if (sysdev->parent && !sysdev->of_node && sysdev->parent->of_node)
+ phydev = sysdev->parent;
/*
* If sysdev->parent->parent is available and part of IOMMU group
* (indicating possible usage of SMMU enablement), then use
@@ -327,7 +330,7 @@
if (device_property_read_u32(&pdev->dev, "usb-core-id", &xhci->core_id))
xhci->core_id = -EINVAL;
- hcd->usb_phy = devm_usb_get_phy_by_phandle(sysdev, "usb-phy", 0);
+ hcd->usb_phy = devm_usb_get_phy_by_phandle(phydev, "usb-phy", 0);
if (IS_ERR(hcd->usb_phy)) {
ret = PTR_ERR(hcd->usb_phy);
if (ret == -EPROBE_DEFER)