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 <vvreddy@codeaurora.org>
This commit is contained in:
Vijayavardhan Vennapusa 2018-01-16 16:19:13 +05:30
commit 4cb2c7ccca

View file

@ -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)