From 4cb2c7cccaaa577a3c8fd4c9e6fcdff3636bc9bd Mon Sep 17 00:00:00 2001 From: Vijayavardhan Vennapusa Date: Tue, 16 Jan 2018 16:19:13 +0530 Subject: [PATCH] xhci-plat: Use correct dev to get usb-phy handle Current code is setting sysdev pointing to USB glue device. This leads to failure of getting usb-phy handle as incorrect device is passed to get handle. Hence fix it by using correct dev pointer to get handle to usb-phy. Change-Id: Ia7ea49b25b346c308815e83ecbcbe05fe701c4cd Signed-off-by: Vijayavardhan Vennapusa --- drivers/usb/host/xhci-plat.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 0ce6929d26ad..a1dedf0ffae9 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -193,7 +193,7 @@ static int xhci_plat_probe(struct platform_device *pdev) { 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 @@ static int xhci_plat_probe(struct platform_device *pdev) * 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 @@ static int xhci_plat_probe(struct platform_device *pdev) 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)